Solum api hangs on non GET root requests

Bug #1367470 reported by Dimitry Ushakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Solum
Fix Released
Undecided
Unassigned

Bug Description

Solum api hangs on the following requests:

POST /
PUT /
HEAD /
PATCH /
DELETE /

GET / correctly responds with platform information. Solum should respond with a 405 (method not allowed) for other methods instead of hanging and taking up a socket.

Revision history for this message
James Li (james-li-3) wrote :

I think solum was expecting a body of a POST.

vagrant@devstack:/opt/stack/solum$ curl -i -d '' -X POST http://10.0.2.15:9777/
HTTP/1.0 200 OK
Date: Wed, 10 Sep 2014 20:28:38 GMT
Server: WSGIServer/0.1 Python/2.7.3
Content-Length: 104
Content-Type: application/json; charset=UTF-8

[{"status": "CURRENT", "link": {"target_name": "v1", "href": "http://10.0.2.15:9777/v1"}, "id": "v1.0"}]

Revision history for this message
Dimitry Ushakov (dimalg) wrote :

James,

Fair enough. It's a bug in wsgi implementation: https://bugs.launchpad.net/pecan/+bug/1221343

Please note that one of the notes on this can be found here: https://github.com/Pylons/webob/issues/116 and that the issue is with wsgiref which is not recommended in production (see comment from @RishiRamraj).

I added tests for this story

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to solum (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/121690

Revision history for this message
Devdatta Kulkarni (devdatta-kulkarni) wrote :

Dimitry,
Thanks for realizing this and adding tests.

Dimitry, James,
So what is our plan for handling this? One option is to make the choice of the wsgi server configurable.. Is this possible?

Other option is to go with some other wsgi server.

http://wsgi.readthedocs.org/en/latest/servers.html

Revision history for this message
Paul Czarkowski (paulcz) wrote :

We can also look at integrating apache with mod_wsgi similar to what keystone does here -
https://github.com/openstack/keystone/blob/c4c8d0b99a0404f4dcdb2f87c48fe15ee1526197/doc/source/apache-httpd.rst

Given that in production a person almost always has the APIs behind a reverse proxy for SSL and other stuff, it might make sense to integrate directly like this.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to solum (master)

Reviewed: https://review.openstack.org/121690
Committed: https://git.openstack.org/cgit/stackforge/solum/commit/?id=3c3a51ede6014e6ca4a2810a8da4675cc3a7fb18
Submitter: Jenkins
Branch: master

commit 3c3a51ede6014e6ca4a2810a8da4675cc3a7fb18
Author: Dimitry Ushakov <email address hidden>
Date: Mon Sep 15 16:57:28 2014 -0500

    Added tests for bug-1367470

    Change-Id: If862b4c412f031cfaf6e4bb4245930d0ce1a532e
    Related-Bug: #1367470

Revision history for this message
Dimitry Ushakov (dimalg) wrote :

Locally validated that switching to mod_wsgi would work.

Essentially, you can remove all references to wsgi_ref.simple_server and utilize mod_wsgi apache module like so:

<IfModule mpm_worker_module>
    ServerLimit 1
    ThreadLimit 1000
    StartServers 1
    MaxClients 1000
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadsPerChild 1000
    MaxRequestsPerChild 0
</IfModule>
CustomLog /dev/null combined
ErrorLog /dev/null

Another option is to use gunicorn (but would have to be coupled with Nginx for best performance)

There's also eventlet and cherrypy (although that's a full fledged framework).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on solum (master)

Change abandoned by Adrian Otto (<email address hidden>) on branch: master
Review: https://review.openstack.org/140468
Reason: You can un-abandon this when we are ready to consider this for merge again.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to solum (master)

Reviewed: https://review.openstack.org/140468
Committed: https://git.openstack.org/cgit/stackforge/solum/commit/?id=f7e5514a20d352863581036eaf95cc45127ebb73
Submitter: Jenkins
Branch: master

commit f7e5514a20d352863581036eaf95cc45127ebb73
Author: Dimitry Ushakov <email address hidden>
Date: Tue Dec 9 13:59:19 2014 -0600

    Use eventlet as wsgi server

    Using eventlet instead of wsgi_server due to wsgi_server not
    being production ready. This is also the direction that other
    projects, such as keystone and nova, use.

    Removing cmd/builder.py with this patch (deprecated)

    Change-Id: Ic77f43522e68b648839d2095c4f7745b33daeefd
    Closes-bug: #1367470

Changed in solum:
status: New → Fix Committed
Adrian Otto (aotto)
Changed in solum:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.