Friday, December 9, 2016

Help Needed: Django Server For High Frequent Requests

I'm building a Django server for data collection. However, the program seems not capable when the sensing network expands. As time goes on, the program doesn't even enter the code piece and report broken pipe/connection reset by peer/too many open files errors:

Exception happened during processing of request from ('172.58.139.243', 30713)  Traceback (most recent call last):    File "/usr/lib/python2.7/SocketServer.py", line 593, in process_request_thread    File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request    File "/usr/lib/python2.7/dist-packages/django/core/servers/basehttp.py", line 126, in __init__    File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__    File "/usr/lib/python2.7/SocketServer.py", line 710, in finish    File "/usr/lib/python2.7/socket.py", line 279, in close    File "/usr/lib/python2.7/socket.py", line 303, in flush  error: [Errno 32] Broken pipe    [08/Dec/2016 17:46:47] "POST /Update_Data/ HTTP/1.1" 500 39484  Traceback (most recent call last):    File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run    File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response    File "/usr/lib/python2.7/wsgiref/handlers.py", line 217, in write    File "/usr/lib/python2.7/socket.py", line 324, in write    File "/usr/lib/python2.7/socket.py", line 303, in flush  error: [Errno 104] Connection reset by peer    File "/usr/lib/python2.7/random.py", line 810, in random  OSError: [Errno 24] Too many open files

I checked the open files and it seems like the socket files are never closed. The list is full of items like the followings:

python    30404 30522     ubuntu  732u     IPv4 2437194784      0t0        TCP 192.168.100.2:9003->172.58.137.113:18538 (ESTABLISHED)  python    30404 30522     ubuntu  733u     IPv4 2437194788      0t0        TCP 192.168.100.2:9003->172.58.137.113:55661 (ESTABLISHED)  python    30404 30522     ubuntu  734u     IPv4 2437194792      0t0        TCP 192.168.100.2:9003->172.58.137.113:42461 (ESTABLISHED)  python    30404 30522     ubuntu  735u     IPv4 2437194793      0t0        TCP 192.168.100.2:9003->172.58.137.113:40438 (ESTABLISHED)  python    30404 30522     ubuntu  736u     IPv4 2437194797      0t0        TCP 192.168.100.2:9003->172.58.137.113:52998 (ESTABLISHED)

Any ideas? Let me know if you need any further information.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/58e4d24e-ca9b-41da-8df7-3e195630b05a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment