Connection reset by peer on file upload if JWT expires

2023-06-02 Thread Larry Martell
We have a django app and it supports a file upload request. The entire
upload comprises multiple requests. We are authenticating with JWT and
we have logic to handle a 401 and in that case use the refresh token
to get a new access token and resend the failed request. However if
the token expires between 2 requests of the same upload the 401
response never makes it to the client. In the logs I found that before
nginx gets the response we get this error:

2023/06/02 16:23:11 [error] 1924925#1924925: *75 readv() failed (104:
Connection reset by peer) while reading upstream, client: xx.xx.xx.xx,
server: foo.com, request: "POST /api/upload/ HTTP/1.1", upstream:
"uwsgi://unix:///bar/foo/our_app/app.sock:", host: "foo.com",
referrer: "http://foo.com:8082/";

This causes the client to get an empty response body and the browser
throws a ERR_CONTENT_LENGTH_MISMATCH error. The entire upload takes
under 10 minutes and we have all the timeouts set to 100 minutes:

uwsgi_read_timeout 6000;
uwsgi_connect_timeout 6000;
uwsgi_send_timeout 6000;
send_timeout 6000;
proxy_read_timeout 6000;
proxy_send_timeout 6000;

What is causing the socket to get closed? How can I prevent that? Are
there other timeouts I could set? Any logging that I can enable to see
why the socket is getting closed? Is there a way to detect this in
code so it can be retried?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACwCsY6ShL02Hhnfbc-uGTsMdKBNV8ij6kom7n9hJndwpRQGwg%40mail.gmail.com.


Re: ConnectionResetError: [Errno 104] Connection reset by peer

2020-08-30 Thread Garrett
Are you asking about the version of Django I'm using?  If so, it's version 
2.2.9.

On Sunday, August 30, 2020 at 6:48:59 PM UTC-7 hellatho...@gmail.com wrote:

> What deployment are you using ?
>  
>
> Garrett  于2020年8月31日周一 上午9:16写道:
>
>> Hello Django community,
>>
>> I'm new to Django, and I recently set up an experimental website using 
>> AWS's Lightsail service.  I've got the website working in the sense that I 
>> can access it from any computer with an internet connection, and the 
>> various pages are functioning as designed.  However, when I check Django's 
>> log, I notice that there is one particular error message which appears 
>> multiple times:
>>
>> 
>> Exception happened during processing of request from ('', 
>> <5-digit number>)
>> Traceback (most recent call last):
>>   File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 650, in 
>> process_request_thread
>> self.finish_request(request, client_address)
>>   File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 360, in 
>> finish_request
>> self.RequestHandlerClass(request, client_address, self)
>>   File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 720, in 
>> __init__
>> self.handle()
>>   File 
>> "/opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.2.9-py3.7.egg/django/core/servers/basehttp.py",
>>  
>> line 169, in handle
>> self.handle_one_request()
>>   File 
>> "/opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.2.9-py3.7.egg/django/core/servers/basehttp.py",
>>  
>> line 179, in handle_one_request
>> self.raw_requestline = self.rfile.readline(65537)
>>   File "/opt/bitnami/python/lib/python3.7/socket.py", line 589, in 
>> readinto
>> return self._sock.recv_into(b)
>> ConnectionResetError: [Errno 104] Connection reset by peer
>> 
>>
>> The  and <5-digit number> are different in each instance of 
>> this error, but the rest of the message is apparently constant.
>>
>> Unfortunately, I don't know how to produce the error, as I've never 
>> caused it myself.  The error is apparently caused by hackers/bots 
>> attempting to break the website, given that it appears in the context of 
>> other malicious-looking entries in the log.  
>>
>> I'm concerned that this error message may indicate a security 
>> vulnerability in my website.  Can anyone explain to me what it means?
>>
>> Garrett
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/7aca60b9-4ec0-4696-8500-4ccaddba94fbo%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/7aca60b9-4ec0-4696-8500-4ccaddba94fbo%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3bab97c2-9969-4c7b-a023-1a6f13fa05e3n%40googlegroups.com.


Re: ConnectionResetError: [Errno 104] Connection reset by peer

2020-08-30 Thread Hella thor
What deployment are you using ?


Garrett  于2020年8月31日周一 上午9:16写道:

> Hello Django community,
>
> I'm new to Django, and I recently set up an experimental website using
> AWS's Lightsail service.  I've got the website working in the sense that I
> can access it from any computer with an internet connection, and the
> various pages are functioning as designed.  However, when I check Django's
> log, I notice that there is one particular error message which appears
> multiple times:
>
> 
> Exception happened during processing of request from ('',
> <5-digit number>)
> Traceback (most recent call last):
>   File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 650, in
> process_request_thread
> self.finish_request(request, client_address)
>   File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 360, in
> finish_request
> self.RequestHandlerClass(request, client_address, self)
>   File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 720, in
> __init__
> self.handle()
>   File
> "/opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.2.9-py3.7.egg/django/core/servers/basehttp.py",
> line 169, in handle
> self.handle_one_request()
>   File
> "/opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.2.9-py3.7.egg/django/core/servers/basehttp.py",
> line 179, in handle_one_request
> self.raw_requestline = self.rfile.readline(65537)
>   File "/opt/bitnami/python/lib/python3.7/socket.py", line 589, in readinto
> return self._sock.recv_into(b)
> ConnectionResetError: [Errno 104] Connection reset by peer
> 
>
> The  and <5-digit number> are different in each instance of
> this error, but the rest of the message is apparently constant.
>
> Unfortunately, I don't know how to produce the error, as I've never caused
> it myself.  The error is apparently caused by hackers/bots attempting to
> break the website, given that it appears in the context of other
> malicious-looking entries in the log.
>
> I'm concerned that this error message may indicate a security
> vulnerability in my website.  Can anyone explain to me what it means?
>
> Garrett
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7aca60b9-4ec0-4696-8500-4ccaddba94fbo%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/7aca60b9-4ec0-4696-8500-4ccaddba94fbo%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAE1PWwNePQMVEyr8FZyOORHMpdf2_ycqcC0Fz3aTaV6%2Bv3X2g%40mail.gmail.com.


ConnectionResetError: [Errno 104] Connection reset by peer

2020-08-30 Thread Garrett
Hello Django community,

I'm new to Django, and I recently set up an experimental website using 
AWS's Lightsail service.  I've got the website working in the sense that I 
can access it from any computer with an internet connection, and the 
various pages are functioning as designed.  However, when I check Django's 
log, I notice that there is one particular error message which appears 
multiple times:


Exception happened during processing of request from ('', 
<5-digit number>)
Traceback (most recent call last):
  File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 650, in 
process_request_thread
self.finish_request(request, client_address)
  File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 360, in 
finish_request
self.RequestHandlerClass(request, client_address, self)
  File "/opt/bitnami/python/lib/python3.7/socketserver.py", line 720, in 
__init__
self.handle()
  File 
"/opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.2.9-py3.7.egg/django/core/servers/basehttp.py",
 
line 169, in handle
self.handle_one_request()
  File 
"/opt/bitnami/apps/django/lib/python3.7/site-packages/Django-2.2.9-py3.7.egg/django/core/servers/basehttp.py",
 
line 179, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
  File "/opt/bitnami/python/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 104] Connection reset by peer


The  and <5-digit number> are different in each instance of 
this error, but the rest of the message is apparently constant.

Unfortunately, I don't know how to produce the error, as I've never caused 
it myself.  The error is apparently caused by hackers/bots attempting to 
break the website, given that it appears in the context of other 
malicious-looking entries in the log.  

I'm concerned that this error message may indicate a security vulnerability 
in my website.  Can anyone explain to me what it means?

Garrett

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7aca60b9-4ec0-4696-8500-4ccaddba94fbo%40googlegroups.com.


Django keep getting 104 connection reset by peer caused by adding simple video, can't forward video

2019-06-20 Thread Dominik Lech
I asked the same question on stackoverflow here: 
https://stackoverflow.com/questions/56667516/django-keep-getting-104-connection-reset-by-peer-caused-by-adding-simple-video.
 

I want to add video to my django template. When I add it, video is 
unforwardable (I can't skip this video to other point, I can just play it 
from start to the end). Excatly the same issue happens when I open link to 
video in new browser tab.

When I close/refresh this page console shows 104 connection reset by peer.

-- 
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+unsubscr...@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/0bf75472-2f45-4c46-be3c-044298f0ee2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting "SMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] Connection reset by peer" errors when using django.core.mail.send_mail in the loop

2019-05-21 Thread Asif Khan
I am facing similar error while I am rendering html template to PDF by 
using xhtml2pdf. Same when my template have small number of rows it works 
perfect to render as pdf but when my result fetch mutiple table rows it 
start processing and after couple of duration give error [Errno 104] 
Connection reset by peer. 

On Tuesday, June 28, 2016 at 7:56:04 PM UTC+5, Haomin Zhang wrote:
>
> Create a command like below, which send a mail to the user if the date 
> meet the requirement:
>
> class Command(BaseCommand):
> help= 'Send mail to user regularly if there have contacts needs 
> reminder'
> 
> def handle(self, *args, **options):
> now = timezone.now().date()
> backlogs = Backlog.objects.all()
> for backlog in backlogs.iterator():
> start_date = backlog.start_date
> end_date = backlog.end_date
> if start_date <= now and now < end_date:
> user = backlog.user
> user_email = user.email
> user_name = user.username
> if user_email is not None:
> mail_title = u'Contracts need to be handling.'
> mail_content = u"Dear:%s,you have messages" % user_name
> link = u"http://xx.xxx.xx.xxx/contract-info/";
> mail_content += link;
> mail_from = 'from_...@xx.com '
> mail_to = [user_email]
> send_mail(mail_title,
>   mail_content,
>   mail_from,
>   mail_to)
>
> This command can run well in local server. But when I launch it on the VPS 
> and if call send_mail more than once, below mesasge appear:
>
> "SMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] 
> Connection reset by peer"
>
> But if only one backlog been filtered and only call once send_mail, it 
> works well.
>
> Does anybody met the issue before? thanks in advance!
>
> -Haomin
>
>

-- 
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+unsubscr...@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/3096908c-c517-481c-8053-d5863b42c1dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connection Reset by Peer

2019-03-11 Thread Jani Tiainen
That another server which is client to your app terminated connection for
some reason. That's most common cause.

ma 11. maalisk. 2019 klo 21.53 Alex Snyder 
kirjoitti:

> There's no browser involved. Just another server. If I manually post it
> works fine.
>
> On Monday, March 11, 2019 at 2:17:22 PM UTC-5, Jani Tiainen wrote:
>>
>> Hi.
>>
>> Usually error means that client (browser) terminated connection before
>> request was completely handled and returned to client.
>>
>>
>>
>>
>> ma 11. maalisk. 2019 klo 17.58 Alex Snyder 
>> kirjoitti:
>>
>>> 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...@googlegroups.com.
>>> To post to this group, send email to django...@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
>>> <https://groups.google.com/d/msgid/django-users/343df769-44f3-4316-882e-a701280b358a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
&

Re: Connection Reset by Peer

2019-03-11 Thread Alex Snyder
There's no browser involved. Just another server. If I manually post it 
works fine.

On Monday, March 11, 2019 at 2:17:22 PM UTC-5, Jani Tiainen wrote:
>
> Hi.
>
> Usually error means that client (browser) terminated connection before 
> request was completely handled and returned to client.
>
>
>
>
> ma 11. maalisk. 2019 klo 17.58 Alex Snyder  > kirjoitti:
>
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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
>>  
>> <https://groups.google.com/d/msgid/django-users/343df769-44f3-4316-882e-a701280b358a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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+unsubscr...@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/12b526ed-da4c-4473-b813-7bbb2c787dfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Connection Reset by Peer

2019-03-11 Thread Jani Tiainen
Hi.

Usually error means that client (browser) terminated connection before
request was completely handled and returned to client.




ma 11. maalisk. 2019 klo 17.58 Alex Snyder 
kirjoitti:

> 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+unsubscr...@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
> <https://groups.google.com/d/msgid/django-users/343df769-44f3-4316-882e-a701280b358a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@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/CAHn91odNQT-kvNmh8fSdgPLOhzRGaSzGTCHaJHzT_yQL4KtGVA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Connection Reset by Peer

2019-03-11 Thread Alex Snyder
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+unsubscr...@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.


Getting "SMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] Connection reset by peer" errors when using django.core.mail.send_mail in the loop

2016-06-28 Thread Haomin Zhang
Create a command like below, which send a mail to the user if the date meet 
the requirement:

class Command(BaseCommand):
help= 'Send mail to user regularly if there have contacts needs 
reminder'

def handle(self, *args, **options):
now = timezone.now().date()
backlogs = Backlog.objects.all()
for backlog in backlogs.iterator():
start_date = backlog.start_date
end_date = backlog.end_date
if start_date <= now and now < end_date:
user = backlog.user
user_email = user.email
user_name = user.username
if user_email is not None:
mail_title = u'Contracts need to be handling.'
mail_content = u"Dear:%s,you have messages" % user_name
link = u"http://xx.xxx.xx.xxx/contract-info/";
mail_content += link;
mail_from = 'from_em...@xx.com'
mail_to = [user_email]
send_mail(mail_title,
  mail_content,
  mail_from,
  mail_to)

This command can run well in local server. But when I launch it on the VPS 
and if call send_mail more than once, below mesasge appear:

"SMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] 
Connection reset by peer"

But if only one backlog been filtered and only call once send_mail, it 
works well.

Does anybody met the issue before? thanks in advance!

-Haomin

-- 
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+unsubscr...@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/f1dc8ce0-6454-474e-b747-15d832b4ac3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Connection Reset by Peer (104) on POST submission

2013-09-04 Thread Brian Henning
I am trying to deploy my Django site. On my development environment using 
runserver, everything works perfectly. After deploying to production with 
Apache and Passenger WSGI on a shared hosting environment, the majority of 
the site works correctly. However, I am having one issue that I am unable 
to figure out.

When submitting a form via POST with enctype="multipart/form-data" and that 
has filefields or imagefields in the form, I get a connection reset page. 
The apache error log shows the following error:

[Wed Sept 4 17:11:53 2013] [error] [client 123.45.6.78] 
(104)Connection reset by peer: ap_content_length_filter: apr_bucket_read() 
failed, referer: http://www.example.com

Has anyone experienced this error or know how to fix it?

Below is the form file, template and view code that handles the POST 
submission:

< forms.py -->
class TestForm(forms.Form):
name = forms.CharField(label='Last Name', max_length=100)
file = forms.ImageField(required=False)
< end forms.py -->

< test_page.html -->








{% if form %}

{% for field in form %}

{{ field.errors }}
{{ field.label_tag }}: {{ field }}

{% endfor %}
{% csrf_token %}


{% endif %}


<--- end test_page.html ---> 

< views.py ->
from django.template import RequestContext
from forms import TestForm

def test_form_view(request):

if request.method == 'POST':

return render_to_response('test_page.html',{},)

else:
return render_to_response('test_page.html',{ 'form': TestForm(), },
context_instance=RequestContext(request))
< end views.py >

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


error: [Errno 104] Connection reset by peer - dev server IE 9

2011-08-26 Thread dm03514
When I am testing my applications using django 1.2 and 1.3 dev server
on IE 9.  Every other requests gives me:

Traceback (most recent call last):
  File "/home/dmican/Envs/monetization/lib/python2.6/site-packages/
django/core/servers/basehttp.py", line 281, in run
self.finish_response()
  File "/home/dmican/Envs/monetization/lib/python2.6/site-packages/
django/core/servers/basehttp.py", line 321, in finish_response
self.write(data)
  File "/home/dmican/Envs/monetization/lib/python2.6/site-packages/
django/core/servers/basehttp.py", line 400, in write
self.send_headers()
  File "/home/dmican/Envs/monetization/lib/python2.6/site-packages/
django/core/servers/basehttp.py", line 464, in send_headers
self.send_preamble()
  File "/home/dmican/Envs/monetization/lib/python2.6/site-packages/
django/core/servers/basehttp.py", line 379, in send_preamble
self._write('HTTP/%s %s\r\n' % (self.http_version,self.status))
  File "/home/dmican/Envs/monetization/lib/python2.6/site-packages/
django/core/servers/basehttp.py", line 508, in _write
self.stdout.write(data)
  File "/usr/lib/python2.6/socket.py", line 297, in write
self.flush()
  File "/usr/lib/python2.6/socket.py", line 284, in flush
self._sock.sendall(buffer)
error: [Errno 104] Connection reset by peer


This is mainly when I am requesting static media, but not
exclusively.  This error can happen on any request.
It is happening way too frequently (every other request) for it to be
a coincidence.  On chrome and firefox I hardly ever see these errors.
Before I dig into it has anyone had a similar experience??? It makes
IE9 un-testable.

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Connection reset by peer error on POST content longer than about 6k chars...

2007-03-16 Thread Joseph Heck
The django development server isn't multithreaded by default, and it's
probably having some trouble serving back the files. There were some
hacks/mods on this last a few months back talking about how to change the
dev server so that it was multithreaded and make it a tad more reliable.

I'm afraid I don't recall the specifics, but it appeared to have the same
signature as your issue.

-joe

On 3/13/07, Ryan Alexander <[EMAIL PROTECTED]> wrote:
>
>
> Function in question:
>
> http://dpaste.com/6787/
>
> Simply put, this is a little client program that goes out to the
> Django server, which tells it which URLS to test and how many times to
> hit them.  It'll average the results, then return the timing info,
> along with the HTML generated by the render (it gets this from a
> global variable.)
>
> Here's the weird part.  If I keep the amount of text pushed back to
> approx. 5-7K chars.  It's fine.  but if I go higher than that, I get
> this error:
>
> Traceback (most recent call last):
>   File "client.py", line 72, in ?
> runtest()
>   File "client.py", line 62, in runtest
> response = opener.open(req , data)
>   File "C:\Python24\lib\urllib2.py", line 358, in open
> response = self._open(req, data)
>   File "C:\Python24\lib\urllib2.py", line 376, in _open
> '_open', req)
>   File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
> result = func(*args)
>   File "C:\Python24\lib\urllib2.py", line 1021, in http_open
> return self.do_open(httplib.HTTPConnection, req)
>   File "C:\Python24\lib\urllib2.py", line 996, in do_open
> raise URLError(err)
> urllib2.URLError: 
>
>
> Can anyone please shed some light on this problem for me?  I'd really
> like to get the whole of the HTML page back to the server so I can do
> some checking of it.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Connection reset by peer error on POST content longer than about 6k chars...

2007-03-13 Thread Ryan Alexander

Function in question:

http://dpaste.com/6787/

Simply put, this is a little client program that goes out to the
Django server, which tells it which URLS to test and how many times to
hit them.  It'll average the results, then return the timing info,
along with the HTML generated by the render (it gets this from a
global variable.)

Here's the weird part.  If I keep the amount of text pushed back to
approx. 5-7K chars.  It's fine.  but if I go higher than that, I get
this error:

Traceback (most recent call last):
  File "client.py", line 72, in ?
runtest()
  File "client.py", line 62, in runtest
response = opener.open(req , data)
  File "C:\Python24\lib\urllib2.py", line 358, in open
response = self._open(req, data)
  File "C:\Python24\lib\urllib2.py", line 376, in _open
'_open', req)
  File "C:\Python24\lib\urllib2.py", line 337, in _call_chain
result = func(*args)
  File "C:\Python24\lib\urllib2.py", line 1021, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File "C:\Python24\lib\urllib2.py", line 996, in do_open
raise URLError(err)
urllib2.URLError: 


Can anyone please shed some light on this problem for me?  I'd really
like to get the whole of the HTML page back to the server so I can do
some checking of it.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---