Ticket #513 (closed bug: fixed)

Opened 6 months ago

Last modified 3 months ago

possible race condition wrt PingThread

Reported by: Tobi Owned by: BrainDamage
Priority: major Milestone: 0.1 basic functionality
Component: code quality Version: windows
Keywords: threading ping Cc:

Description

I was trying to get SL working somewhat more stable with VC 9, and stumbled upon a possible cause for a race condition:

The issue is that in Socket::Disconnect() _EnablePingThread( false ) is called INSIDE the LOCK_SOCKET block.

However, if you're unlucky, the ping thread may be just after evaluation of the following condition in the if statement, but just before calling Send().

void Socket::Ping()
{
  // wxLogMessage( _T("Sent ping.") );

  if ( m_ping_msg != wxEmptyString ) Send( m_ping_msg );
}

If this is the case then Send() will try to enter the socket critical section too (LOCK_SOCKET there too), while it was already locked by the main thread that's now waiting for the ping thread to finish.

Attachments

Change History

Changed 5 months ago by koshi

  • milestone set to 0.1 basic functionality

look into if this has been dealt with

Changed 4 months ago by koshi

  • owner changed from - to BrainDamage

i really can't make much of this

Changed 3 months ago by BrainDamage

  • status changed from new to closed
  • resolution set to fixed

Add/Change #513 (possible race condition wrt PingThread)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.