bugGNUstep - Bugs: bug #58550, WebServer - Deadlock due to...

 
 

bug #58550: WebServer - Deadlock due to missing socketAddress

Submitted by:  David Ayers <ayers>
Submitted on:  Fri 12 Jun 2020 09:29:31 AM UTC  
 
Category:  Libraries Severity:  3 - Normal
Item Group:  Bug Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 12 Jun 2020 12:16:50 PM UTC, comment #3: 

Indeed, this was based off of a release tag.  Thanks for the fix! And a new release would be great.

David Ayers <ayers>
Project Member
Fri 12 Jun 2020 10:23:50 AM UTC, comment #2: 

Actually, it looks like it was already fixed long ago: time to make a release perhaps.

However, the current code, while adding @"unknown" to the counted set (and thus avoiding the exception and locking issue), is removing nil at the end of the connection, which of course means that the counted set will get the number of connections for an 'unknown' host wrong.  That's a much less important bug, but still a bug.

I will change the code to use 'unknown' as the host name consistently.

Richard Frith-Macdonald <CaS>
Project Member
Fri 12 Jun 2020 10:09:26 AM UTC, comment #1: 

Thanks ... clearly a bug ... I'll fix that now.

Richard Frith-Macdonald <CaS>
Project Member
Fri 12 Jun 2020 09:29:31 AM UTC, original submission:  

The WebServer method _didConnect retrieves the foreign socketAddress from the file handle.  The refusal message addresses the possibility of that address being nil.  Yet later the variable for the address is unconditionally added the the _perHost set which raises an Exception while holding the WebServer lock, leading to a deadlock upon the next request.

Problem posting notification: <NSException: 0x55e7b5b0fd80> NAME:NSInvalidArgumentException REASON:Tried to nil value to counted set INFO:(null)

      • -[NSLock lock]: deadlock (<NSLock: 0x55e7a9a75ed0> (locked by 19025))
      • Break on _NSLockError() to debug.

Later in _endConnect the address is also conditionally removed again, but that only invokes a warning if address is nil.

I do not know what the intended behavior is but I've fixed/worked around the problem, by simply checking for nil and not adding or removing the nil value to or from the set.

David Ayers <ayers>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by ayers (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-06-12 ayers StatusConfirmed => None
    2020-06-12 CaS StatusNone => Confirmed

    Back to the top


    Powered by Savane 3.5