Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception happened during processing of request from ('127.0.0.1', 54766) #367

Open
akkdio opened this issue Nov 20, 2020 · 3 comments
Open

Comments

@akkdio
Copy link

akkdio commented Nov 20, 2020

Location within the Book

  • Book order number: 11172
  • Book build date (Is the date on page 1):BETA CCD-2020-09-16

Daniel Feldroy, Audrey Feldroy. Django Crash Course (Kindle Location 7).

  • Book format (PDF, Epub or Mobi): kindle

  • Chapter or Appendix: Chapter 22

  • Section: 22.1

  • Subsection:

  • What operating system are you using:

    • [x ] MacOS Catalina

Hint: Page numbers change all the time. The best way to report an issue is by chapter, section, and subsection numbers.

Description

The server stops and starts and I believe is the reason I am not seeing my activation code for signing up a user.

output:

Exception happened during processing of request from ('127.0.0.1', 54766)
Traceback (most recent call last):
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/socketserver.py", line 720, in init
self.handle()
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 174, in handle
self.handle_one_request()
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/core/servers/basehttp.py", line 182, in handle_one_request
self.raw_requestline = self.rfile.readline(65537)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/socket.py", line 669, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [Errno 54] Connection reset by peer

however the page is still up:

image

if you click on the home link the server comes back:

[20/Nov/2020 05:05:52] "GET / HTTP/1.1" 200 14179
[20/Nov/2020 05:05:52] "GET /static/js/project.js HTTP/1.1" 304 0
[20/Nov/2020 05:05:52] "GET /static/css/project.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:52] "GET /static/debug_toolbar/css/toolbar.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:53] "GET /static/debug_toolbar/img/ajax-loader.gif HTTP/1.1" 304 0
[20/Nov/2020 05:05:53] "GET /static/debug_toolbar/js/toolbar.js HTTP/1.1" 304 0
[20/Nov/2020 05:05:53] "GET /static/debug_toolbar/css/print.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:54] "GET /about/ HTTP/1.1" 200 14206
[20/Nov/2020 05:05:54] "GET /static/js/project.js HTTP/1.1" 304 0
[20/Nov/2020 05:05:54] "GET /static/debug_toolbar/css/toolbar.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:54] "GET /static/css/project.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:54] "GET /static/debug_toolbar/js/toolbar.js HTTP/1.1" 304 0
[20/Nov/2020 05:05:54] "GET /static/debug_toolbar/img/ajax-loader.gif HTTP/1.1" 304 0
[20/Nov/2020 05:05:54] "GET /static/debug_toolbar/css/print.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:56] "GET / HTTP/1.1" 200 14181
[20/Nov/2020 05:05:56] "GET /static/debug_toolbar/css/toolbar.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:56] "GET /static/css/project.css HTTP/1.1" 304 0
[20/Nov/2020 05:05:56] "GET /static/js/project.js HTTP/1.1" 304 0
[20/Nov/2020 05:05:56] "GET /static/debug_toolbar/img/ajax-loader.gif HTTP/1.1" 304 0
[20/Nov/2020 05:05:56] "GET /static/debug_toolbar/js/toolbar.js HTTP/1.1" 304 0
[20/Nov/2020 05:05:56] "GET /static/debug_toolbar/css/print.css HTTP/1.1" 304 0

Possible Solutions

Restarted mac and terminals and now I get the email for signup. Not sure what the issue was but the server seems steady now.

Your full name so we can provide accurate credit within the book

d

@akkdio akkdio closed this as completed Nov 21, 2020
@akkdio
Copy link
Author

akkdio commented Nov 22, 2020

Re-opening this issue. The app works and then it does not. Same error as far as I can tell.

ConnectionResetError: [Errno 54] Connection reset by peer

@akkdio akkdio reopened this Nov 22, 2020
@akkdio
Copy link
Author

akkdio commented Nov 22, 2020

Most recent error:

`Environment:

Request Method: POST
Request URL: http://localhost:8000/accounts/login/

Django Version: 3.1.1
Python Version: 3.8.5
Installed Applications:
['whitenoise.runserver_nostatic',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.forms',
'crispy_forms',
'allauth',
'allauth.account',
'allauth.socialaccount',
'everycheese.users.apps.UsersConfig',
'everycheese.cheeses.apps.CheesesConfig',
'debug_toolbar',
'django_extensions']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.common.BrokenLinkEmailsMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware']

Traceback (most recent call last):
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
connection = Database.connect(**conn_params)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/psycopg2/init.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

The above exception (server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
) was the direct cause of the following exception:
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/contextlib.py", line 74, in inner
with self._recreate_cm():
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/transaction.py", line 175, in enter
if not connection.get_autocommit():
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/base/base.py", line 389, in get_autocommit
self.ensure_connection()
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
connection = Database.connect(**conn_params)
File "/Users/andrewgellene/opt/miniconda3/envs/everycheese/lib/python3.8/site-packages/psycopg2/init.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

Exception Type: OperationalError at /accounts/login/
Exception Value: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
`

@akkdio
Copy link
Author

akkdio commented Nov 25, 2020

If anyone can help resolve...

site-packages/psycopg2/__init__.py", line 127, in connect

seems to be the issue. Line 127 is this:

conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

I have googled around for a hint but no solutions. The weird / hard issue is that the server connects and works for a little bit. But then just stops. I re-did the setup twice and the issue shows up in 18.6 when you run the server for the first time on the everycheese project.

The pg_isready return:
/tmp:5432 - accepting connections
So the db is ready.

I did notice the book shows the directory as::
/var/run /postgresql: 5432 accepting connections
and mine is '/tmp: could this be a hint?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant