Changes between Version 199 and Version 200 of WikiStart


Ignore:
Timestamp:
Mar 19, 2019, 9:39:06 PM (7 months ago)
Author:
jtv
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v199 v200  
    99
    1010= News =
     11
     12== 2019-03-19: Bug in result objects outliving their connection objects ==
     13
     14This one took a while to figure out.  The underlying C driver was doing something subtly unexpected.  As a result, a libpqxx application will accidentally access de-allocated memory (and probably crash) when ''all of the following things happen together:''
     15 1. The application receives a `result` object from a connection.
     16 2. It destroys the connection object, but keeps the `result`.
     17 3. And, it continues using the `result`.
     18 4. Then, some operation on the `result` causes the underlying C driver, `libpq`, to issue an error or warning message.
     19
     20Nothing happens in "normal" cases because error or warning messages are pretty rare.  For instance, the problem was first spotted in a test which tries to retrieve the name of a nonexistent result column — not something most applications will try.
     21
     22To make it even more obscure, the crash only happened with some compilers.  Don't think that makes them bad compilers; it's sheer stupid coincidence that we never noticed any symptoms of the problem before.
     23
     24How to proceed?  There isn't much that I can do about this without risking performance degradation.  The next release though, 6.4.0, will make the bug yet easier to avoid.  The bug can then only happen if the connection ''also has an `errorhandler` registered on it at the time when it produced the `result`.''  And of course documentation will warn you about this, as a risk of installing error handlers.
     25
     26It's still a nasty complication though, and if you have any clever ideas on how to improve the situation, please file a bug on our Github page!
     27
    1128
    1229== 2019-02-02: 6.3.0 released ==