11.04.2017 2:33, Adriano dos Santos Fernandes wrote: > Here is a better description of the problem and a possible fix that Vlad > can use and discard, as he surely better understand this part. > > Sorry for some imprecision in my previous description. > > Jaybird synchronized the op_queue_events send/response. > > Remote queue_events synchronizes with the *sync* port lock. > > When event callback is called by the engine, before delivery the event, > remote marks it as dead (event->rvnt_iface = NULL) but using the *async* > port lock. > > Even the different locks (sync / async) is not the underling problem by > the way events are marked and verified as dead. > > But after event is marked as dead, que_events can concurrently reuse it, > and reuse its rvnt_id. > > The problem is that the callback reads rvnt_id after mark it as dead. > > So here is my proposed patch.
Your description is correct and i've considered this kind of fix too. Another one was to include search for unused event at rem_port::que_events under scope of async port lock. Finally i committed a bit more efficient (i think) fix which allows to not extend async port lock scope. Thanks, Vlad PS Mark, snapshot build of v4 contains a fix and could be tested ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel