Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2017-02-25 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
-+-
 Reporter:  Aymeric Augustin |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Core (Other) |  Version:  master
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  app-loading  | 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 Tim Graham ):

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


Comment:

 In [changeset:"fba4f831bc75369c975a95c9b7774e9e89f8a2f9" fba4f83]:
 {{{
 #!CommitTicketReference repository=""
 revision="fba4f831bc75369c975a95c9b7774e9e89f8a2f9"
 Fixed #27176 -- Raised an exception for reentrant calls to
 apps.populate().

 Thanks to Aymeric Augustin, Harry Percival, and Tim Graham.
 }}}

--
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/067.4f37de44d26d324065ca9d880e6dd45e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2017-02-24 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
-+-
 Reporter:  Aymeric Augustin |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Core (Other) |  Version:  master
 Severity:  Normal   |   Resolution:
 Keywords:  app-loading  | 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 Tim Graham):

 * 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 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/067.9f7c905d4898d43369a49818b40de941%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2017-02-21 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
--+
 Reporter:  Aymeric Augustin  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  app-loading   | Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by François Freitag):

 * needs_better_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 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/067.170e9fe83d041f0128a468b97d23bbab%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2017-02-17 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
--+
 Reporter:  Aymeric Augustin  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  app-loading   | 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


--
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/067.3d91add6facb8540221900335d49dbdd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2017-01-01 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
--+
 Reporter:  Aymeric Augustin  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  app-loading   | Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by François Freitag):

 * needs_better_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 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/067.b9512cdb812efb33c3fd5698f8f3173a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2016-12-14 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
--+
 Reporter:  Aymeric Augustin  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  app-loading   | 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


Comment:

 Comments for improvement are on the 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/067.316f562b2d470eabacefa2e3d0960af5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2016-12-12 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
--+
 Reporter:  Aymeric Augustin  |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  app-loading   | Triage Stage:  Accepted
Has patch:  1 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by François Freitag):

 * has_patch:  0 => 1


Comment:

 PR: https://github.com/django/django/pull/7682

--
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/067.b6e91c9f34ae9d5ee535403e00f3eae1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2016-09-05 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
--+
 Reporter:  aaugustin |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  app-loading   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by timgraham):

 * stage:  Unreviewed => 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 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/067.4799e5d0fbf9bc28e91b39363dd67b54%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2016-09-04 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
--+--
 Reporter:  aaugustin |Owner:  nobody
 Type:  Bug   |   Status:  new
Component:  Core (Other)  |  Version:  master
 Severity:  Normal|   Resolution:
 Keywords:  app-loading   | Triage Stage:  Unreviewed
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+--

Comment (by aaugustin):

 The ticket description is purely based #26152 and on code analysis. I
 didn't test my theory.

 I'd like to investigate further and submit a patch, but I'm not sure when
 I'll have time for that, so feel free to assign the ticket and work on it
 if you're interested.

--
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/067.25fd084bcde8b927c88a0684c3687459%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27176: django.setup() should raise an exception instead of hanging on re-entrant calls

2016-09-04 Thread Django
#27176: django.setup() should raise an exception instead of hanging on 
re-entrant
calls
+-
   Reporter:  aaugustin |  Owner:  nobody
   Type:  Bug   | Status:  new
  Component:  Core (Other)  |Version:  master
   Severity:  Normal|   Keywords:  app-loading
   Triage Stage:  Unreviewed|  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+-
 #25864 and #26152 discuss issues with calling `django.setup()` in a file
 that is imported during the app-loading process. This is actually about
 `apps.populate()` -- I wrote `django.setup()` in the title because it's
 the public API people are familiar with.

 Actually there are three cases.

 1. If `django.setup()` has already completed successfully, calling it
 again returns immediately.

 {{{
 if self.ready:
 return
 }}}

 2. If `django.setup()` is running in another thread, calling it again
 returns as soon as that other thread has completed the process.

 {{{
 # populate() might be called by two threads in parallel on servers
 # that create threads before initializing the WSGI callable.
 with self._lock:
 if self.ready:
 return
 }}}

 3. If `django.setup()` is running in the same thread, calling it must
 crash. Indeed, `django.setup()` isn't allowed to return until app-loading
 has completed. The first call cannot complete without going through the
 second one, which cannot return, so there's a deadlock. The code tries to
 detect this condition:

 {{{
 # app_config should be pristine, otherwise the code below
 won't
 # guarantee that the order matches the order in
 INSTALLED_APPS.
 if self.app_configs:
 raise RuntimeError("populate() isn't reentrant")
 }}}

 #26152 suggest that the code hangs instead of raising an exception.
 Indeed, the second call must block on `with self._lock:`, since
 `self._lock` isn't reentrant. Making it a `RLock` instead of a `Lock`
 should allow the second thread to proceed and to hit that exception.

 Also the error condition is incorrect: it won't trigger if the reentrant
 call happens while importing the first app. (We're reasoning in the single
 threaded case, which is easy.) Instead `populate()` should set a private
 attribute before it starts importing apps and raise the exception if that
 attribute is set. Alternatively it could check if the `RLock` is being
 taken for the second time, but no public API for this appears to exist.

--
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/052.5e4d521336f288177ad35b7f7ee260f7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.