bugGNUstep - Bugs: bug #33717, WebServer is restricted to main...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #33717: WebServer is restricted to main thread

Submitted by:  Sergei Golovin <svg>
Submitted on:  Tue 05 Jul 2011 10:47:04 AM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri 09 Sep 2011 05:39:19 AM UTC, comment #5:

Thanks for testing ... I've updated the latest release in ftp and on the website.

Richard Frith-Macdonald <CaS>
Project Member
Mon 05 Sep 2011 09:38:29 AM UTC, comment #4:

I have tried and it works well with my tests.

Sergei Golovin <svg>
Fri 02 Sep 2011 08:16:00 AM UTC, comment #3:

I've modified this to be a change request rather than a bug report ...

> The WebServer's documentation doesn't explicitly state that such
> design (a Webserver isn't running on the main thread) is bad.


Actually, the documentation mentions working from the main thread in a few places and says:

NB. the -completedWithResponse: method is safe to call from any thread
but all other methods of the class should be called only from the
main thread.

However, I like the idea of making the class usable from any thread... it seems like a useful improvement.

Richard Frith-Macdonald <CaS>
Project Member
Mon 08 Aug 2011 11:20:14 AM UTC, comment #2:

Now I see the patch has been introduced in the subversion trunk.

But I still have issues with test2 (attached) emulating the shutdown of an instance with living connections. It uses a particular thread different from the main one to run the WebServer. So all those -[performSelectorOnMainThread:withObject:waitUntilDone:]s are posting to an invalid thread (it leads to exceptions or segfaults because scheduled on the main thread performers or events may arrive AFTER the method -[GSFileHandle closeFile] has been called on the WebServer's particular thread).

The WebServer's documentation doesn't explicitly state that such design (a Webserver isn't running on the main thread) is bad.
Patching the WebServer with performSelector.patch makes execution of test2 successful.

(file #23759, file #23760)

Sergei Golovin <svg>
Wed 06 Jul 2011 05:25:41 AM UTC, comment #1:

The attached patch is wrong because it is made without awareness of current living connections.

Sergei Golovin <svg>
Tue 05 Jul 2011 10:47:04 AM UTC, original submission:

Calling -[setPort:secure:] with nil as the value of the port stops listening of the server and shuts the instance down. But it leaves the listening port busy some time after.
I have attached the fixing patch and the test showing the problem.

Sergei Golovin <svg>

 

Attached Files
file #23759:  webserver-test2.tar.bz2 added by svg (1KiB - application/x-bzip - The test2 with a WebServer instance running on the particular thread. The performSelector.patch allows to get rid of the issue.)
file #23760:  WebServer_performSelector.patch added by svg (2KiB - text/x-patch - The test2 with a WebServer instance running on the particular thread. The performSelector.patch allows to get rid of the issue.)
file #23622:  WebServer_closeFile.patch added by svg (406B - text/x-patch - The patch and the test)
file #23623:  webserver-test.tar.bz2 added by svg (905B - application/x-bzip - The patch and the test)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 09 Sep 2011 05:39:19 AM UTCCaSStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Fri 02 Sep 2011 08:16:00 AM UTCCaSItem GroupNone=>Change Request
      SummaryWebServer doesn\'t graciously stop listening=>WebServer is restricted to main thread
    Mon 08 Aug 2011 11:20:14 AM UTCsvgAttached File-=>Added webserver-test2.tar.bz2, #23759
      Attached File-=>Added WebServer_performSelector.patch, #23760
    Tue 05 Jul 2011 10:47:04 AM UTCsvgAttached File-=>Added WebServer_closeFile.patch, #23622
      Attached File-=>Added webserver-test.tar.bz2, #23623

    Back to the top


    Powered by Savane 3.1-cleanup1