mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 02:03:03 +01:00
Backport fix for race condition when two different events could use same instance of unused Rvnt.
Details at fb-devel, thread "Concurrency bugs in posting events?" by Mark Rotteveel. Thanks to Adriano for discovering issue.
This commit is contained in:
parent
40a7c45b27
commit
c2d3266fce
@ -917,6 +917,19 @@ public:
|
||||
if (!allowCancel)
|
||||
return;
|
||||
|
||||
if (!(port->port_flags & PORT_disconnect))
|
||||
{
|
||||
PACKET packet;
|
||||
packet.p_operation = op_event;
|
||||
P_EVENT* p_event = &packet.p_event;
|
||||
p_event->p_event_database = rdb->rdb_id;
|
||||
p_event->p_event_items.cstr_length = length;
|
||||
p_event->p_event_items.cstr_address = items;
|
||||
p_event->p_event_rid = event->rvnt_id;
|
||||
|
||||
port->send(&packet);
|
||||
}
|
||||
|
||||
if (event->rvnt_iface)
|
||||
{
|
||||
LocalStatus ls;
|
||||
@ -924,19 +937,6 @@ public:
|
||||
event->rvnt_iface->cancel(&status_vector);
|
||||
event->rvnt_iface = NULL;
|
||||
}
|
||||
|
||||
if (port->port_flags & PORT_disconnect)
|
||||
return;
|
||||
|
||||
PACKET packet;
|
||||
packet.p_operation = op_event;
|
||||
P_EVENT* p_event = &packet.p_event;
|
||||
p_event->p_event_database = rdb->rdb_id;
|
||||
p_event->p_event_items.cstr_length = length;
|
||||
p_event->p_event_items.cstr_address = items;
|
||||
p_event->p_event_rid = event->rvnt_id;
|
||||
|
||||
port->send(&packet);
|
||||
}
|
||||
|
||||
int release()
|
||||
@ -4746,8 +4746,8 @@ ISC_STATUS rem_port::que_events(P_EVENT * stuff, PACKET* sendL)
|
||||
{
|
||||
if (!event->rvnt_iface)
|
||||
{
|
||||
event->rvnt_destroyed = 0;
|
||||
break;
|
||||
if (event->rvnt_destroyed.compareExchange(1, 0))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user