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

Group
 
 

bug #58550: WebServer - Deadlock due to missing socketAddress

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

Add a New Comment Rich Markup
   

Mon 26 Oct 2020 08:24:02 AM UTC, comment #4: 

Should this be closed?

Gregory John Casamento <gcasa>
Group administrator
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>
Group 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>
Group 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>
Group 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>
Group 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 gcasa (Posted a comment)
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by ayers (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-26 CaS Open/ClosedOpen Closed
    2020-10-26 gcasa Assigned toNone CaS
    2020-06-12 ayers StatusConfirmed None
    2020-06-12 CaS StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code