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

Group
 
 

bug #33717: WebServer is restricted to main thread

Submitter:  Sergei Golovin <svg>
Submitted:  Tue 05 Jul 2011 10:47:04 AM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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>

 

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

Attach Files:
   
   
Comment:
   

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
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by svg (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-09-09 CaS StatusNone Fixed
        Open/ClosedOpen Closed
    2011-09-02 CaS Item GroupNone Change Request
        SummaryWebServer doesn\'t graciously stop listening WebServer is restricted to main thread
    2011-08-08 svg Attached File- Added webserver-test2.tar.bz2, #23759
        Attached File- Added WebServer_performSelector.patch, #23760
    2011-07-05 svg Attached File- Added WebServer_closeFile.patch, #23622
        Attached File- Added webserver-test.tar.bz2, #23623

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code