Skip Menu |

This queue is for tickets about the Apache-Singleton CPAN distribution.

Report information
The Basics
Id: 68534
Status: resolved
Priority: 0/
Queue: Apache-Singleton

People
Owner: Nobody in particular
Requestors: shay [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.12
Fixed in: (no value)



Subject: Singleton objects are not always destroyed properly
The Apache::Singleton::Process class, being very much like Class::Singleton, suffers from the same problem with its singleton objects not being destroyed in a predictable manner as I've reported for Class::Singleton in CPAN RT #68526. The bug report has not yet been responded to, so I thought another pair of eyes on the case wouldn't hurt. (By all means close this report as basically a duplicate of that one if you wish, and if you're able to help with the problem then add your comments to that report. This is just a heads-up, really.) The test program that I attached to that bug report exhibits similar problems, although, typically, with slightly different results, if you just change Class::Singleton to Apache::Singleton and replace the has_instance() call with call to instance() instead.
It should be noted that this really only refers to Process singletons, not Apache::Singleton::Request The problem is that destruction is happening during perl's global destruction sequence. At that time, object destruction order is random. In other words, just because A holds a reference to B, that does not mean that B gets destroyed before A during the global destruction phase. I don't know offhand what the best solution to this is. Apache::Singleton::Process is modelled on Class::Singleton which has the same problem.
On Mon May 30 00:16:57 2011, MSCHOUT wrote: Show quoted text
> It should be noted that this really only refers to Process singletons, > not Apache::Singleton::Request > > The problem is that destruction is happening during perl's global > destruction sequence. At that time, object destruction order is random. > In other words, just because A holds a reference to B, that does not > mean that B gets destroyed before A during the global destruction phase. > > I don't know offhand what the best solution to this is. > Apache::Singleton::Process is modelled on Class::Singleton which has the > same problem.
I reported this problem on the Class-Singleton queue (#68526) but got no response. However, I have since noticed that #23568 (also on the Class-Singleton queue) is caused by the same problem, and has a patch to fix it! The patch works for me, fixing the problems that I reported on #68526, so I've just updated that patch for the current release of Class-Singleton, and have requested on both tickets that a new release be made incorporating the patch. Meanwhile, could you consider incorporating something similar into Apache-Singleton to fix the problem with Apache::Singleton::Process?
I have integrated this into Apache::Singleton v0.16, which I have just uploaded to CPAN. Let me know if this fixes the issue for you (or not). Thanks!
On Fri Nov 07 09:43:11 2014, MSCHOUT wrote: Show quoted text
> I have integrated this into Apache::Singleton v0.16, which I have just > uploaded to CPAN. > > Let me know if this fixes the issue for you (or not). > > Thanks!
Thanks for the speedy response! Yes, the new version works like a charm. I've also just uploaded Class-Singleton version 1.5 with the same fix (Andy gave me co-maint on it since he didn't have time to do it himself).