Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#10699 closed Feature Requests (fixed)

Add a build flag to increase the size of REPORT_ERROR_BUFFER_SIZE

Reported by: albert.gil@… Owned by: Gennadiy Rozental
Milestone: Boost 1.59.0 Component: test
Version: Boost Release Branch Severity: Cosmetic
Keywords: Cc:

Description

Hi,

Before requesting anything, please let me say that I've been using the Boost.Test library for more than 5 years and it is just great, thanks a lot!

And the small question or request: Do you think that is a good idea to add a building flag or macro to tune the REPORT_ERROR_BUFFER_SIZE?

The idea is just to add some lines like these in the file test/impl/execution_monitor.ipp:

#ifdef BOOST_TEST_ERROR_SIZE_VALUE
    #define REPORT_ERROR_BUFFER_SIZE BOOST_TEST_ERROR_SIZE_VALUE
#else
    #define REPORT_ERROR_BUFFER_SIZE 512
#endif

And remove/replace the static const int REPORT_ERROR_BUFFER_SIZE of function report_error, of course.

Does it has any sense to you?

Thanks!

Albert

PS: I assume that it's not possible to use "string" to hold any length of message, right?

PS: We need longer messages because in debug mode our exceptions print a backtrace, and 512 chars is just too few...

Change History (4)

comment:1 by maxim.yegorushkin@…, 8 years ago

I second that because this limited buffer size truncates my nice stack traces from exceptions and I have to fire up gdb to find the full stack trace, e.g.:

cd /home/max/otsquant/build/Linux-x86_64-64.g++-debug/test-results && /home/max/otsquant/build/Linux-x86_64-64.g++-debug/test/fix_db_connection_test --log_level=test_suite
Running 1 test case...
Entering test suite "fix"
Entering test case "insert"
unknown location(0): fatal error in "insert": std::runtime_error: ot::Ex<std::runtime_error, void>: SQLExecDirect(): (-1)[42601][7]ERROR: syntax error at or near "\";
Error while executing the query
StackTrace(20 frames):
 0: ot::odbc::detail::throw_on_odbc_error(short, void*, short, char const*)(/home/max/otsquant/src/c++/util/odbc.cc:56)
 1: ot::odbc::detail::Handle<void*, (short)3>::verify(short, char const*) const(/home/max/otsquant/src/c++/util/odbc.h:124)
 2: ot::odbc::StatementHandle::execute(char const*)(/home/max/otsquant/src/c++/util/odbc.c <---- truncate here
Leaving test case "insert"; testing time: 11861mks
Leaving test suite "fix"

A proper fix would be to make the buffer size dynamic and remove any limits.

comment:2 by Gennadiy Rozental, 7 years ago

Milestone: To Be DeterminedBoost 1.59.0
Resolution: fixed
Status: newclosed
Version: Boost Development TrunkBoost Release Branch

This is changed to 4096. hopefully this is enough for your purposes

comment:3 by maxim.yegorushkin@…, 7 years ago

Well, this fix smacks of "640K ought to be enough for anyone."

Remove the limit or make it configurable, please.

comment:4 by Albert Gil <albert.gil@…>, 7 years ago

Replying to rogeeff:

This is changed to 4096. hopefully this is enough for your purposes

It probably is...
And in fact I already used this as workaround some times.

But I think that this is not an actual fix, right?

What do you think about the solution proposed in the description?
Altough doing it dynamic is for sure the best solution, the usage of a build parameter (define/macro) seems to me as a small patch and useful enogh?

Thanks!

Albert

PD: This is a duplicate of #7046? I didn't found it when I created the ticket...

Note: See TracTickets for help on using tickets.