google-code-export / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
2 stars 1 forks source link

Scopes.SINGLETON does not detect re-entrant calls #391

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Original bug report: http://code.google.com/p/peaberry/issues/detail?id=35
Original diagnosis:
http://peaberry.googlecode.com/issues/attachment?aid=-5668176808220216508&name=b
ug.txt

Problem was tracked down to a circular dependency that isn't detected by
Guice, presumably because there's a provider involved in the circle? This
then had an interesting side-effect in the SINGLETON class where it made
two re-entrant calls.

The re-entrant call isn't detected by the SINGLETON code, so it silently
creates multiple instances. A flag could be added so it knows when it is
already processing a request - it could then report a circularity error.
But I'm not sure if this is worthwhile, or whether it is better to find out
why the original circularity was not detected.

Original issue reported on code.google.com by mccu...@gmail.com on 15 Jun 2009 at 4:19

GoogleCodeExporter commented 9 years ago
Here's a simple testcase that demonstrates the issue.

Original comment by mccu...@gmail.com on 15 Jun 2009 at 4:31

Attachments:

GoogleCodeExporter commented 9 years ago
Here's the full diagnosis:
http://peaberry.googlecode.com/issues/attachment?aid=-7636042361803612250&name=d
iagnosis.txt
(the bug.txt attachment in the original issue was a truncated version)

Original comment by mccu...@gmail.com on 15 Jun 2009 at 4:36

GoogleCodeExporter commented 9 years ago
Checked in a test as r1044.

Original comment by limpbizkit on 14 Jul 2009 at 12:46

GoogleCodeExporter commented 9 years ago
Having been bitten badly by this bug in a production application, I'd like to 
vote
enthusiastically for a simple flag in the SINGLETON code to detect this. It 
would
have saved much wailing and gnashing of teeth. Even if you come up with a more
sophisticated solution later, this would benefit users _now_. I'll be using a
customized version of Guice with such a check, until it shows up in a release 
version.

Original comment by m...@j.maxb.eu on 1 Oct 2009 at 7:14

GoogleCodeExporter commented 9 years ago
jesse fixed this in r1114.

Original comment by sberlin on 22 Feb 2010 at 8:14