Monday, March 11, 2019

Connection Reset by Peer

Hello,
I'm working on a webhook receiver and all was working fine the other day. Now I'm receiving connection reset by peer errors. The data being posted is getting received so and I can't figure out why it all of a sudden started giving errors.

Could it be that connections are coming in too quickly? It didn't have a problem with it before.

I'm getting the following:
Exception happened during processing of request from ('redacted', 58812)
Traceback (most recent call last):
  File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py", line 360, in finish_request

    self.RequestHandlerClass(request, client_address, self)
  File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socketserver.py", line 720, in __init__
    self.handle()
  File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 171, in han
dle
    self.handle_one_request()
  File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 179, in han
dle_one_request
    self.raw_requestline = self.rfile.readline(65537)
  File "/Users/myuser/anaconda3/envs/myenv/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer


My View

@require_POST
@csrf_exempt
def computer_checkin(request):
    if request.method == 'POST':
        #ip = get_client_ip(request)
        print(request)
        #request_data = json.loads(request.body.decode("utf-8"))
        #print(ip)
        return HttpResponse(201)
    else:
        return HttpResponse(400)
        # if ip in allowed_ip:
        #     #print(request_data['webhook']['webhookEvent'])
        #     return HttpResponse('Pong')
        # else
        #     return HttpResponseForbidden('Permissions denied')


This is what the sending server gives for an error:
Exception while trying to post event to http://redacted:8000/webhooks/ComputerCheckIn - I/O error on POST request for "http://redacted:8000/webhooks/ComputerCheckIn":Connect to redacted:8000 [/redacted] failed: connect timed out; nested exception is org.apache.http.conn.ConnectTimeoutException: Connect to redacted:8000 [/redacted] failed: connect timed out


--
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/343df769-44f3-4316-882e-a701280b358a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment