Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2023-04-12 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  Anvesh Mishra
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+-
Changes (by Mariusz Felisiak):

 * status:  closed => new
 * has_patch:  1 => 0
 * resolution:  fixed =>
 * stage:  Ready for checkin => Accepted


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018776651180-3c0cd662-41b1-4d55-9c07-38575634918f-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2023-04-12 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
-+-
 Reporter:  direx|Owner:  Anvesh
 |  Mishra
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  2.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"2feb9333e7044df348c45417d23ee20b08c1a7fd" 2feb933]:
 {{{
 #!CommitTicketReference repository=""
 revision="2feb9333e7044df348c45417d23ee20b08c1a7fd"
 [4.2.x] Fixed #34484, Refs #34482 -- Reverted "Fixed #29186 -- Fixed
 pickling HttpRequest and subclasses."

 This reverts commit 6220c445c40a6a7f4d442de8bde2628346153963.

 Thanks Adam Johnson and Márton Salomváry for reports.

 Backport of 280ca147af9cdfce1ca9cb14cc3c5527ff6c7a02 from main
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701877663d77f-8d0b8765-f501-455a-9a46-54cf82bcc9a5-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2023-04-12 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
-+-
 Reporter:  direx|Owner:  Anvesh
 |  Mishra
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  2.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak ):

 In [changeset:"280ca147af9cdfce1ca9cb14cc3c5527ff6c7a02" 280ca147]:
 {{{
 #!CommitTicketReference repository=""
 revision="280ca147af9cdfce1ca9cb14cc3c5527ff6c7a02"
 Fixed #34484, Refs #34482 -- Reverted "Fixed #29186 -- Fixed pickling
 HttpRequest and subclasses."

 This reverts commit 6220c445c40a6a7f4d442de8bde2628346153963.

 Thanks Adam Johnson and Márton Salomváry for reports.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018776626a20-91ff37d3-a459-4707-8b80-e8167bfb56fb-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-09-14 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
-+-
 Reporter:  direx|Owner:  Anvesh
 |  Mishra
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  2.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"6220c445c40a6a7f4d442de8bde2628346153963" 6220c44]:
 {{{
 #!CommitTicketReference repository=""
 revision="6220c445c40a6a7f4d442de8bde2628346153963"
 Fixed #29186 -- Fixed pickling HttpRequest and subclasses.
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701833bd455f3-7e5ceabf-ee4e-414f-8dcb-0c357bdd7f8a-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-09-14 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
-+-
 Reporter:  direx|Owner:  Anvesh
 |  Mishra
 Type:  Bug  |   Status:  assigned
Component:  Core (Other) |  Version:  2.0
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  1 => 0
 * needs_tests:  1 => 0
 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701833bae0bd3-36338b9b-0dd9-413a-93dc-f6fbd5fc8542-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-08-09 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  Anvesh Mishra
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  1 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1
 * needs_tests:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701828422f665-dd948f81-40f6-4032-ab6f-95396cabe327-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-08-09 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  Anvesh Mishra
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+-

Comment (by Anvesh Mishra):

 Submitted a [https://github.com/django/django/pull/15937 patch]

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018284104533-9d640b41-908d-4dce-b84a-5d00aa9d086d-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-08-08 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  Anvesh Mishra
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+-

Comment (by Mariusz Felisiak):

 Replying to [comment:15 Anvesh Mishra]:
 > Replying to [comment:11 Mariusz Felisiak]:
 > > Stripping non-picklable attributes may be an acceptable solution, see
 similar change for `HttpResponse`
 d7f5bfd241666c0a76e90208da1e9ef81aec44db.
 > Felix if you could give an idea about what the non-picklable attributes
 could be in this case?

 You should be able to find out after creating a regression test.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018280c1f6f9-a6215749-9079-4932-ba8f-708e825f4fce-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-08-08 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  Anvesh Mishra
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+-

Comment (by Anvesh Mishra):

 Replying to [comment:11 Mariusz Felisiak]:
 > Stripping non-picklable attributes may be an acceptable solution, see
 similar change for `HttpResponse`
 d7f5bfd241666c0a76e90208da1e9ef81aec44db.
 Felix if you could give an idea about what the non-picklable attributes
 could be?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701827f56a37e-65a2cc65-fd17-4c0f-9928-e4604e654f42-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-08-03 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  Anvesh Mishra
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+-
Changes (by Anvesh Mishra):

 * owner:  (none) => Anvesh Mishra
 * status:  new => assigned


Comment:

 Replying to [comment:11 Mariusz Felisiak]:
 > Stripping non-picklable attributes may be an acceptable solution, see
 similar change for `HttpResponse`
 d7f5bfd241666c0a76e90208da1e9ef81aec44db.

 Yeah seems like a valid solution gonna work on it.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701826343284f-51c1a730-9caf-4174-9b7c-a28cee61621d-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-07-28 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+
 Reporter:  direx |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * cc: Anvesh Mishra (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182445dfe5b-5744a4af-3ce1-4b51-8fe3-d0fb596652ee-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-07-22 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+
 Reporter:  direx |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * needs_better_patch:  1 => 0
 * has_patch:  1 => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182253d5466-aaf67eb6-6c38-4eea-aa6c-fbda7c86e0e3-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-07-22 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+
 Reporter:  direx |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+

Comment (by Mariusz Felisiak):

 Stripping non-picklable attributes may be an acceptable solution, see
 similar change for `HttpResponse`
 d7f5bfd241666c0a76e90208da1e9ef81aec44db.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182253d054f-f5125f2f-0812-4e7e-9497-bae6ec7bd72a-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2022-07-22 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+
 Reporter:  direx |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Mariusz Felisiak):

 * owner:  HyunTae Hwang => (none)
 * status:  assigned => new


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701822536a632-c8fc976b-2cfd-47ed-a108-cbf0b3b6a53a-00%40eu-central-1.amazonses.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2021-06-10 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  HyunTae Hwang
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+-

Old description:

> Just wondering what the status of this is.  I get occasional errors like
> the following in my log file.  Looks like it's this same issue.  I'm
> running Django 3.1.8.
>

> {{{
> --- Logging error ---
> Traceback (most recent call last):
>   File "/data/project/spi-tools-dev/python-
> distros/Python-3.7.3-install/lib/python3.7/logging/handlers.py", line
> 630, in emit
> s = self.makePickle(record)
>   File "/data/project/spi-tools-dev/python-
> distros/Python-3.7.3-install/lib/python3.7/logging/handlers.py", line
> 602, in makePickle
> s = pickle.dumps(d, 1)
>   File "/data/project/spi-tools-dev/python-
> distros/Python-3.7.3-install/lib/python3.7/copyreg.py", line 65, in
> _reduce_ex
> raise TypeError("can't pickle %s objects" % base.__name__)
> TypeError: can't pickle _Input objects
> Call stack:
>   File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-
> packages/django/core/handlers/wsgi.py", line 133, in __call__
> response = self.get_response(request)
>   File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-
> packages/django/core/handlers/base.py", line 136, in get_response
> request=request,
>   File "/data/project/spi-tools-dev/www/python/venv/lib/python3.7/site-
> packages/django/utils/log.py", line 230, in log_response
> exc_info=exc_info,
> }}}

New description:

 When setting up logging with Python's default `SocketHandler` then the log
 messages produced by `django.request` cause an exception in the logging
 system. This happens everywhere where Django passes an `extra={'request':
 request}` dictionary to log messages. The reason for this is that the
 request object cannot be pickled.

 Steps to reproduce (example):

 1. `./manage.py startproject`
 1. Add this logging config in settings:
 {{{
 LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'socket_handler': {
'class': 'logging.handlers.SocketHandler',
'host': '127.0.0.1',
'port': 9020,
}
},
'loggers': {
'django.request': {
'handlers': ['socket_handler'],
'level': 'INFO',
'propagate': False,
},
}
 }
 }}}
 1. `./manage.py migrate`
 1. `./manage.py runserver`
 1. `wget http://127.0.0.1:8000/invalid -O /dev//null`

 The exception is this one:

  {{{
  --- Logging error ---
 Traceback (most recent call last):
   File "/usr/lib/python3.6/logging/handlers.py", line 633, in emit
 s = self.makePickle(record)
   File "/usr/lib/python3.6/logging/handlers.py", line 605, in makePickle
 s = pickle.dumps(d, 1)
   File "/usr/lib/python3.6/copyreg.py", line 65, in _reduce_ex
 raise TypeError("can't pickle %s objects" % base.__name__)
 TypeError: can't pickle BufferedReader objects
 Call stack:
   File "/usr/lib/python3.6/threading.py", line 884, in _bootstrap
 self._bootstrap_inner()
   File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
 self.run()
   File "/usr/lib/python3.6/threading.py", line 864, in run
 self._target(*self._args, **self._kwargs)
   File "/usr/lib/python3.6/socketserver.py", line 639, in
 process_request_thread
 self.finish_request(request, client_address)
   File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
 self.RequestHandlerClass(request, client_address, self)
   File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
 self.handle()
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/core/servers/basehttp.py", line 154, in handle
 handler.run(self.server.get_app())
   File "/usr/lib/python3.6/wsgiref/handlers.py", line 137, in run
 self.result = application(self.environ, self.start_response)
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/contrib/staticfiles/handlers.py", line 66, in __call__
 return self.application(environ, start_response)
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/core/handlers/wsgi.py", line 146, in __call__
 response = self.get_response(request)
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/core/handlers/base.py", line 93, in get_response
 

Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2021-06-10 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  HyunTae Hwang
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+-

Comment (by Roy Smith):

 Replying to [comment:7 Jacob Walls]:
 > Hi Roy. It's waiting for a volunteer to contribute a patch or improve
 the existing one. In fact, would you mind reverting the changes you made
 to the body of the ticket? By overwriting all the repro instructions and
 potential solutions in the ticket body, the result is to make it extremely
 difficult for a volunteer to stroll by and pick up this ticket. Use the
 "diff" link in "Description:   modified (diff)". Thanks!

 Whoops, I didn't intend to do anything other than leave a comment.  Not
 sure what I did to muck up the body of the ticket.  I'd be happy to revert
 that, but I'm not sure how.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.e62aa81bf682865ef7e50bf15eed1758%40djangoproject.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2021-06-10 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  HyunTae Hwang
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+-

Comment (by Jacob Walls):

 Hi Roy. It's waiting for a volunteer to contribute a patch. In fact, would
 you mind reverting the changes you made to the body of the ticket? By
 overwriting all the repro instructions and potential solutions in the
 ticket body, the result is to make it extremely difficult for a volunteer
 to stroll by and pick up this ticket. Use the "diff" link in "Description:
 modified (diff)". Thanks!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.82f950cebe26e149d4203c3741756a83%40djangoproject.com.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2021-06-04 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  HyunTae Hwang
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+-

Old description:

> When setting up logging with Python's default `SocketHandler` then the
> log messages produced by `django.request` cause an exception in the
> logging system. This happens everywhere where Django passes an
> `extra={'request': request}` dictionary to log messages. The reason for
> this is that the request object cannot be pickled.
>
> Steps to reproduce (example):
>
> 1. `./manage.py startproject`
> 1. Add this logging config in settings:
> {{{
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'handlers': {
> 'socket_handler': {
> 'class': 'logging.handlers.SocketHandler',
> 'host': '127.0.0.1',
> 'port': 9020,
> }
> },
> 'loggers': {
> 'django.request': {
> 'handlers': ['socket_handler'],
> 'level': 'INFO',
> 'propagate': False,
> },
> }
> }
> }}}
> 1. `./manage.py migrate`
> 1. `./manage.py runserver`
> 1. `wget http://127.0.0.1:8000/invalid -O /dev//null`
>
> The exception is this one:
>
> {{{
> --- Logging error ---
> Traceback (most recent call last):
>   File "/usr/lib/python3.6/logging/handlers.py", line 633, in emit
> s = self.makePickle(record)
>   File "/usr/lib/python3.6/logging/handlers.py", line 605, in makePickle
> s = pickle.dumps(d, 1)
>   File "/usr/lib/python3.6/copyreg.py", line 65, in _reduce_ex
> raise TypeError("can't pickle %s objects" % base.__name__)
> TypeError: can't pickle BufferedReader objects
> Call stack:
>   File "/usr/lib/python3.6/threading.py", line 884, in _bootstrap
> self._bootstrap_inner()
>   File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
> self.run()
>   File "/usr/lib/python3.6/threading.py", line 864, in run
> self._target(*self._args, **self._kwargs)
>   File "/usr/lib/python3.6/socketserver.py", line 639, in
> process_request_thread
> self.finish_request(request, client_address)
>   File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
> self.RequestHandlerClass(request, client_address, self)
>   File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
> self.handle()
>   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
> packages/django/core/servers/basehttp.py", line 154, in handle
> handler.run(self.server.get_app())
>   File "/usr/lib/python3.6/wsgiref/handlers.py", line 137, in run
> self.result = application(self.environ, self.start_response)
>   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
> packages/django/contrib/staticfiles/handlers.py", line 66, in __call__
> return self.application(environ, start_response)
>   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
> packages/django/core/handlers/wsgi.py", line 146, in __call__
> response = self.get_response(request)
>   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
> packages/django/core/handlers/base.py", line 93, in get_response
> extra={'status_code': 404, 'request': request},
> Message: 'Not Found: %s'
> Arguments: ('/invalid',)
> }}}
>

> Of course these steps are only an example. This bug does not only apply
> to 404 errors, but also to CSRF verfication errors for instance. In fact
> all places where the `request` object is passed in as an `extra` logger
> argument.
>
> I see a few possible solutions for this issue:
>
> 1. Remove the `request` object from the `extra` log message dict. Right
> now I am not even sure why this is required.
> 1. Make the entire `request` object pickleable (probably not an easy
> task)
> 1. Pass in a reduced (pickable) version of the request object in the
> `extra` dict
> 1. Ship a compatible version of `SocketHandler`
>
> BTW: socket logging is explicitly mentioned in the Django docs:
>
> > The handler is the engine that determines what happens to each message
> in a logger. It describes a particular logging behavior, such as writing
> a message to the screen, to a file, **or to a network socket**.
>
> This bug also applies to older Django versions.

New description:

 Just wondering what the status of this is.  I get occasional errors like
 the following in my log file.  Looks like it's this same issue.  I'm
 running Django 3.1.8.


 

Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2019-02-21 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  HyunTae Hwang
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+-
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1
 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.874eb5c5941b64fe236bec50e28243ac%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2018-12-17 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  candypoplatte
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+-

Comment (by candypoplatte):

 I made a Pull Request. [https://github.com/django/django/pull/10758]

 Respect to direx and Tim, I think django framework has to replace the
 SocketHandler to its own SocketHandler that replace the WSGIRequest object
 with pickle-able dictionary.

 Dhango framework should respect the design philosophy of Python. So it’s
 unfair changing SocketHandler.

 And it’s unfair blocking SocketHandler or removing request object when it
 passed into handlers.

 I wonder this approach is okay. Please check this PR.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.e4b89f00dcb4325a9a72367be29174e1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2018-12-15 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+-
 Reporter:  direx |Owner:  candypoplatte
 Type:  Bug   |   Status:  assigned
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+-
Changes (by candypoplatte):

 * owner:  nobody => candypoplatte
 * status:  new => assigned


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.7b0d89a4160327be09de4b91f91b044f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2018-03-05 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+
 Reporter:  direx |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+

Comment (by direx):

 Just for the record: A custom SocketHandler which works around this
 problem could look like this:

 {{{
 # -*- coding: utf-8 -*-
 from logging.handlers import SocketHandler as _SocketHandler

 class DjangoSocketHandler(_SocketHandler):
 def emit(self, record):
 if hasattr(record, 'request'):
 record.request = None
 return super().emit(record)
 }}}

 I don't know if you guys want to ship this as a workaround and update the
 documentation accordingly. This could also be a ''documentation-only'' fix
 where this code is added as an example for socket logging.

 On the other hand an actual fix would be nice of course. I know this is
 not an easy task and since the majority of people probably won't be using
 socket logging, a documented and supported workaround (such as the code
 above) might be sufficient.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.641973abd7083f04df6202c0ea6a3e35%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2018-03-05 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
--+
 Reporter:  direx |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

 * component:  Uncategorized => Core (Other)
 * stage:  Unreviewed => Accepted


Comment:

 I'm not sure what the best solution is, but I don't think removing
 `request` from `extra` is acceptable as that would be backwards
 incompatible for logging handlers using that information.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.cf5b4ebbb420ff9acb56da5cf97814c1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #29186: "django.request" logging breaks "logging.handlers.SocketHandler"

2018-03-05 Thread Django
#29186: "django.request" logging breaks "logging.handlers.SocketHandler"
-+
   Reporter:  direx  |  Owner:  nobody
   Type:  Bug| Status:  new
  Component:  Uncategorized  |Version:  2.0
   Severity:  Normal |   Keywords:
   Triage Stage:  Unreviewed |  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+
 When setting up logging with Python's default `SocketHandler` then the log
 messages produced by `django.request` cause an exception in the logging
 system. This happens everywhere where Django passes an `extra={'request':
 request}` dictionary to log messages. The reason for this is that the
 request object cannot be pickled.

 Steps to reproduce (example):

 1. `./manage.py startproject`
 1. Add this logging config in settings:
 {{{
 LOGGING = {
 'version': 1,
 'disable_existing_loggers': False,
 'handlers': {
 'socket_handler': {
 'class': 'logging.handlers.SocketHandler',
 'host': '127.0.0.1',
 'port': 9020,
 }
 },
 'loggers': {
 'django.request': {
 'handlers': ['socket_handler'],
 'level': 'INFO',
 'propagate': False,
 },
 }
 }
 }}}
 1. `./manage.py migrate`
 1. `./manage.py runserver`
 1. `wget http://127.0.0.1:8000/invalid -O /dev//null`

 The exception is this one:

 {{{
 --- Logging error ---
 Traceback (most recent call last):
   File "/usr/lib/python3.6/logging/handlers.py", line 633, in emit
 s = self.makePickle(record)
   File "/usr/lib/python3.6/logging/handlers.py", line 605, in makePickle
 s = pickle.dumps(d, 1)
   File "/usr/lib/python3.6/copyreg.py", line 65, in _reduce_ex
 raise TypeError("can't pickle %s objects" % base.__name__)
 TypeError: can't pickle BufferedReader objects
 Call stack:
   File "/usr/lib/python3.6/threading.py", line 884, in _bootstrap
 self._bootstrap_inner()
   File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
 self.run()
   File "/usr/lib/python3.6/threading.py", line 864, in run
 self._target(*self._args, **self._kwargs)
   File "/usr/lib/python3.6/socketserver.py", line 639, in
 process_request_thread
 self.finish_request(request, client_address)
   File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
 self.RequestHandlerClass(request, client_address, self)
   File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
 self.handle()
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/core/servers/basehttp.py", line 154, in handle
 handler.run(self.server.get_app())
   File "/usr/lib/python3.6/wsgiref/handlers.py", line 137, in run
 self.result = application(self.environ, self.start_response)
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/contrib/staticfiles/handlers.py", line 66, in __call__
 return self.application(environ, start_response)
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/core/handlers/wsgi.py", line 146, in __call__
 response = self.get_response(request)
   File "/home/direx/virtualenv/django-2.0/lib/python3.6/site-
 packages/django/core/handlers/base.py", line 93, in get_response
 extra={'status_code': 404, 'request': request},
 Message: 'Not Found: %s'
 Arguments: ('/invalid',)
 }}}


 Of course these steps are only an example. This bug does not only apply to
 404 errors, but also to CSRF verfication errors for instance. In fact all
 places where the `request` object is passed in as an `extra` logger
 argument.

 I see a few possible solutions for this issue:

 1. Remove the `request` object from the `extra` log message dict. Right
 now I am not even sure why this is required.
 1. Make the entire `request` object pickleable (probably not an easy task)
 1. Pass in a reduced (pickable) version of the request object in the
 `extra` dict
 1. Ship a compatible version of `SocketHandler`

 BTW: socket logging is explicitly mentioned in the Django docs:

 > The handler is the engine that determines what happens to each message
 in a logger. It describes a particular logging behavior, such as writing a
 message to the screen, to a file, **or to a network socket**.

 This bug also applies to older Django versions.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django