Hi Guys,
I have a similar issues as described in this (1)old thread as well as (2)this one and arises when trying to set the evaluation date of the Settings class.
My current situation is as follows
- Using the QuantLib's C# SWIG bindings;
- NUnit 2.5.7 is being used for unit tests
The issues arises when running all the unit test from the NUnit test runner. The error is thrown when trying to set the evaluation date of the Settings instance using the C# 'Settings.instance().setEvaluationDate()' function.
I get the following error in a message box.
"Runtime Error!
Program: C:\Program Files\NUnit 2.5.7\bin\net-2.0\nuit-agent.exe
R6025
- pure virtual function call"
Microsoft has KB article related to this R6025 error but I'm not sure how to relate this to the QuantLib C++ code as well the C# Swig bindings.
The error is consistent in that I am unable to run all my unit tests. However, the test at which it fails is always inconsistent - sometime it may fail at the third test while other times it may run over half the tests before it fails. A point to note is that if each test is run individually, it passes.
I thought the issue may be related to how the singleton is managed via Swig which prompted this Stackoverflow question about generating singletons in Swig about using a different Swig declaration to set the evaluation date.This yielded no positive results. In the linked threads above, Nathan Abbot suggests that the issue lies with .Net AppDomains and provides a solution and provides a solution which I was the foundation of the SO question.
Regards,
--
Ahmad Mahomed
------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev C# code with Unit error msg.jpg (57K) Download Attachment |
Hello, i too experienced this error in Java when i did several swap evaluations in a row yesterday. The code runs nicely several times and then throws the "pure virtual function call" which crashes the JVM. It always happens on "setEvaluationDate" in the Settings class. I would be really happy to see this fixed, since it makes QuantLib practically unusable in my scenario. I will try myself, but i am far from being a SWIG expert. Software used: Windows 7 x64 QuantLib 1.0.1 SWIG 2.0.0 Java 1.6.0_22 QuantLib compiled with Visual Studio Express 2008 Best regards, Henner Heck Am 29.12.2010, 08:02 Uhr, schrieb Ahmad Mahomed <[hidden email]>: > Hi Guys, > > I have a similar issues as described in this (1)old > thread<http://is.gd/jGlUb> as > well as (2)this one <http://is.gd/jGmeM> and arises when trying to set > the > evaluation date of the Settings class. > > My current situation is as follows > - Using the QuantLib's C# SWIG bindings; > - NUnit 2.5.7 is being used for unit tests > > The issues arises when running all the unit test from the NUnit test > runner. > The error is thrown when trying to set the evaluation date of the > Settings > instance using the C# 'Settings.instance().setEvaluationDate()' > function. > > I get the following error in a message box. > > "Runtime Error! > Program: C:\Program Files\NUnit 2.5.7\bin\net-2.0\nuit-agent.exe > > R6025 > - pure virtual function call" > > Microsoft has KB article related to this R6025 > error<http://support.microsoft.com/kb/125749> but > I'm not sure how to relate this to the QuantLib C++ code as well the C# > Swig > bindings. > > The error is consistent in that I am unable to run all my unit tests. > However, the test at which it fails is always inconsistent - sometime it > may > fail at the third test while other times it may run over half the tests > before it fails. A point to note is that if each test is run > individually, > it passes. > > I thought the issue may be related to how the singleton is managed via > Swig > which prompted this Stackoverflow question about generating singletons in > Swig <http://stackoverflow.com/q/4069204/268667> about using a different > Swig declaration to set the evaluation date.This yielded no positive > results. In the linked threads above, Nathan Abbot suggests that the > issue > lies with .Net AppDomains and provides a solution and provides a solution > which I was the foundation of the SO question. > > Regards, > -- Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/ ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
On Wed, 2010-12-29 at 19:05 +0100, Henner Heck wrote:
> i too experienced this error in Java when i did > several swap evaluations in a row yesterday. > The code runs nicely several times and then throws the > "pure virtual function call" which crashes the JVM. > It always happens on "setEvaluationDate" in the Settings class. Do you happen to have a traceback? (setEvaluationDate triggers the update() method of its observers. It owuld be useful to know which one is responsible, if any.) Luigi -- Steinbach's Guideline for Systems Programming: Never test for an error condition you don't know how to handle. ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hello Luigi, here are some call stacks i managed to get. I ran the program several times and attached the Visual Studio debugger to the Java process. I had tried manual calls to the Java garbage collector before, to see if they might solve the problem, which they didn't. But the sets of possible call stacks seem to differ, depending on whether the gc was run manually or not, though it could also be, that i just didn't try often enough. One of these call stacks were presented when the program got the "pure virtual function call" error: With the Java garbage collection run manually before each swap evaluation: QuantLibJNI.dll!_purecall() Line 54 + 0x7 bytes C > QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 119 + > 0x31 bytes C++ QuantLibJNI.dll!QuantLib::BootstrapHelper<QuantLib::YieldTermStructure>::update() Line 153 C++ QuantLibJNI.dll!QuantLib::RelativeDateBootstrapHelper<QuantLib::YieldTermStructure>::update() Line 114 C++ QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 119 + 0x31 bytes C++ QuantLibJNI.dll!QuantLib::ObservableValue<QuantLib::Date>::operator=(const QuantLib::Date & t={...}) Line 81 C++ QuantLibJNI.dll!QuantLib::Settings::DateProxy::operator=(const QuantLib::Date & d={...}) Line 37 C++ QuantLibJNI.dll!Settings_setEvaluationDate(QuantLib::Settings * self=0x0582d970, const QuantLib::Date & d={...}) Line 4384 C++ QuantLibJNI.dll!Java_org_quantlib_QuantLibJNI_Settings_1setEvaluationDate(JNIEnv_ * jenv=0x023b4518, _jclass * jcls=0x0229fa4c, __int64 jarg1=92461424, _jobject * jarg1_=0x0229fa60, __int64 jarg2=92545208, _jobject * jarg2_=0x0229fa54) Line 24282 + 0xd bytes C++ 02499f47() jvm.dll!6d8e3a9c() [Frames below may be incorrect and/or missing, no symbols loaded for jvm.dll] jvm.dll!6d976591() jvm.dll!6d8e3b1d() jvm.dll!6d8ed365() msvcr71.dll!7c3416b3() ntdll.dll!776f9d15() Without the manual garbage collection: QuantLibJNI.dll!_purecall() Line 54 + 0x7 bytes C > QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 119 + > 0x31 bytes C++ QuantLibJNI.dll!QuantLib::InterestRateIndex::update() Line 94 C++ QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 119 + 0x31 bytes C++ QuantLibJNI.dll!QuantLib::ObservableValue<QuantLib::Date>::operator=(const QuantLib::Date & t={...}) Line 81 C++ QuantLibJNI.dll!QuantLib::Settings::DateProxy::operator=(const QuantLib::Date & d={...}) Line 37 C++ QuantLibJNI.dll!Settings_setEvaluationDate(QuantLib::Settings * self=0x057fd970, const QuantLib::Date & d={...}) Line 4384 C++ QuantLibJNI.dll!Java_org_quantlib_QuantLibJNI_Settings_1setEvaluationDate(JNIEnv_ * jenv=0x00454518, _jclass * jcls=0x0024fa4c, __int64 jarg1=92264816, _jobject * jarg1_=0x0024fa60, __int64 jarg2=95332160, _jobject * jarg2_=0x0024fa54) Line 24282 + 0xd bytes C++ 02509f47() jvm.dll!6d8e3a9c() [Frames below may be incorrect and/or missing, no symbols loaded for jvm.dll] jvm.dll!6d976591() jvm.dll!6d8e3b1d() jvm.dll!6d8ed365() msvcr71.dll!7c3416b3() ntdll.dll!776f9d15() Appeared in both cases: QuantLibJNI.dll!_purecall() Line 54 + 0x7 bytes C > QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 119 + > 0x31 bytes C++ QuantLibJNI.dll!QuantLib::FloatingRateCoupon::update() Line 96 + 0x19 bytes C++ QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 119 + 0x31 bytes C++ QuantLibJNI.dll!QuantLib::InterestRateIndex::update() Line 94 C++ QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 119 + 0x31 bytes C++ QuantLibJNI.dll!QuantLib::ObservableValue<QuantLib::Date>::operator=(const QuantLib::Date & t={...}) Line 81 C++ QuantLibJNI.dll!QuantLib::Settings::DateProxy::operator=(const QuantLib::Date & d={...}) Line 37 C++ QuantLibJNI.dll!Settings_setEvaluationDate(QuantLib::Settings * self=0x057fd970, const QuantLib::Date & d={...}) Line 4384 C++ QuantLibJNI.dll!Java_org_quantlib_QuantLibJNI_Settings_1setEvaluationDate(JNIEnv_ * jenv=0x02334518, _jclass * jcls=0x01c9fa4c, __int64 jarg1=92264816, _jobject * jarg1_=0x01c9fa60, __int64 jarg2=95531456, _jobject * jarg2_=0x01c9fa54) Line 24282 + 0xd bytes C++ 02419f47() jvm.dll!6d8e3a9c() [Frames below may be incorrect and/or missing, no symbols loaded for jvm.dll] jvm.dll!6d976591() jvm.dll!6d8e3b1d() jvm.dll!6d8ed365() msvcr71.dll!7c3416b3() ntdll.dll!776f9d15() I hope it helps. Best regards, Henner Heck > On Wed, 2010-12-29 at 19:05 +0100, Henner Heck wrote: >> i too experienced this error in Java when i did >> several swap evaluations in a row yesterday. >> The code runs nicely several times and then throws the >> "pure virtual function call" which crashes the JVM. >> It always happens on "setEvaluationDate" in the Settings class. > > Do you happen to have a traceback? (setEvaluationDate triggers the > update() method of its observers. It owuld be useful to know which one > is responsible, if any.) > > Luigi > > > -- Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/ ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Luigi,
I have a similar call stack which also seems to error at notifyObservers(Line119). I truncated the C# bits. msvcr90d.dll!1023c355()
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr90d.dll]
msvcr90d.dll!1023e1fa() msvcr90d.dll!102dccd7()
>> NQuantLibc.dll!QuantLib::Observable::notifyObservers() Line 119 + 0x31 bytes C++
NQuantLibc.dll!QuantLib::ObservableValue<QuantLib::Date>::operator=(const QuantLib::Date & t) Line 81 C++
NQuantLibc.dll!QuantLib::Settings::DateProxy::operator=(const QuantLib::Date & d) Line 37 C++
NQuantLibc.dll!Settings_setEvaluationDate(QuantLib::Settings * self, const QuantLib::Date & d) Line 5944 C++
NQuantLibc.dll!CSharp_Settings_setEvaluationDate(void * jarg1, void * jarg2) Line 25380 + 0xd bytes C++
[External Code] NQuantLib.DLL!QuantLib.Settings.setEvaluationDate(QuantLib.Date d) Line 57 + 0x2d bytes C#
XXXX.SetDates(System.DateTime settlementDate, System.DateTime todaysDate) Line 155 + 0x10 bytes C#
On 30 December 2010 22:45, Henner Heck <[hidden email]> wrote:
-- Ahmad Mahomed ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
I changed the pure virtual update() method in QuantLib::Observer to this to get a breakpoint inside the observer that causes the error: virtual void update() { DebugBreak(); } Here is one quick scenario i got from the debugger when the DebugBreak() triggered: - this 0x19ef7398 {observables_=[3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} }) } QuantLib::Observer * const + __vfptr 0x62780ee8 const QuantLib::Observer::`vftable' * - observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} }) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable> > > - [0] {px=0x19bfd760 pn={...} } boost::shared_ptr<QuantLib::Observable> - px 0x19bfd760 {coupon_=??? discount_=??? gearing_=??? ...} QuantLib::Observable * + __vfptr 0x627c6054 const QuantLib::BlackIborCouponPricer::`vftable'{for `QuantLib::Observable'} * - observers_ [13](0x19ef7e28 {iborIndex_={...} },0x19ef7d58 {iborIndex_={...} },0x19ef7c88 {iborIndex_={...} },0x19ef7bb8 {iborIndex_={...} },0x19ef7ae8 {iborIndex_={...} },0x19ef7a18 {iborIndex_={...} },0x19ef7948 {iborIndex_={...} },0x19ef7878 {iborIndex_={...} },0x19ef77a8 {iborIndex_={...} },0x19ef76d8 {iborIndex_={...} },0x19ef7608 {iborIndex_={...} },0x19ef7538 {iborIndex_={...} },0x19ef7468 {iborIndex_=,...) std::list<QuantLib::Observer *,std::allocator<QuantLib::Observer *> > + [0] 0x19ef7e28 {iborIndex_={...} } QuantLib::Observer * + [1] 0x19ef7d58 {iborIndex_={...} } QuantLib::Observer * + [2] 0x19ef7c88 {iborIndex_={...} } QuantLib::Observer * + [3] 0x19ef7bb8 {iborIndex_={...} } QuantLib::Observer * + [4] 0x19ef7ae8 {iborIndex_={...} } QuantLib::Observer * + [5] 0x19ef7a18 {iborIndex_={...} } QuantLib::Observer * + [6] 0x19ef7948 {iborIndex_={...} } QuantLib::Observer * + [7] 0x19ef7878 {iborIndex_={...} } QuantLib::Observer * + [8] 0x19ef77a8 {iborIndex_={...} } QuantLib::Observer * + [9] 0x19ef76d8 {iborIndex_={...} } QuantLib::Observer * + [10] 0x19ef7608 {iborIndex_={...} } QuantLib::Observer * + [11] 0x19ef7538 {iborIndex_={...} } QuantLib::Observer * + [12] 0x19ef7468 {iborIndex_={...} } QuantLib::Observer * + pn {pi_=0x19eecfd0 } boost::detail::shared_count - [1] {px=0x19d69608 pn={...} } boost::shared_ptr<QuantLib::Observable> - px 0x19d69608 {observers_=[1218](0x19f17418 {iborIndex_={...} },0x19f17348 {iborIndex_={...} },0x19f17278 {iborIndex_={...} },0x19f171a8 {iborIndex_={...} },0x19f170d8 {iborIndex_={...} },0x19f17008 {iborIndex_={...} },0x19f16f38 {iborIndex_={...} },0x19f16e68 {iborIndex_={...} },0x19f16d98 {iborIndex_={...} },0x19f16cc8 {iborIndex_={...} },0x19f16bf8 {iborIndex_={...} },0x19f16b28 {iborIndex_= }, QuantLib::Observable * + __vfptr 0x6277f90c const QuantLib::Observable::`vftable' * + observers_ [1218](0x19f17418 {iborIndex_={...} },0x19f17348 {iborIndex_={...} },0x19f17278 {iborIndex_={...} },0x19f171a8 {iborIndex_={...} },0x19f170d8 {iborIndex_={...} },0x19f17008 {iborIndex_={...} },0x19f16f38 {iborIndex_={...} },0x19f16e68 {iborIndex_={...} },0x19f16d98 {iborIndex_={...} },0x19f16cc8 {iborIndex_={...} },0x19f16bf8 {iborIndex_={...} },0x19f16b28 {iborIndex_={...} },0x19f16a58 {iborIndex,...) std::list<QuantLib::Observer *,std::allocator<QuantLib::Observer *> > + pn {pi_=0x19d685e8 } boost::detail::shared_count - [2] {px=0x19dc5638 pn={...} } boost::shared_ptr<QuantLib::Observable> - px 0x19dc5638 QuantLib::Observable * + [QuantLib::Euribor6M] {...} QuantLib::Euribor6M + __vfptr 0x627858c4 const QuantLib::Euribor6M::`vftable'{for `QuantLib::Index'} * - observers_ [14](0x19ef7e28 {iborIndex_={...} },0x19ef7d58 {iborIndex_={...} },0x19ef7c88 {iborIndex_={...} },0x19ef7bb8 {iborIndex_={...} },0x19ef7ae8 {iborIndex_={...} },0x19ef7a18 {iborIndex_={...} },0x19ef7948 {iborIndex_={...} },0x19ef7878 {iborIndex_={...} },0x19ef77a8 {iborIndex_={...} },0x19ef76d8 {iborIndex_={...} },0x19ef7608 {iborIndex_={...} },0x19ef7538 {iborIndex_={...} },0x19ef7468 {iborIndex_=,...) std::list<QuantLib::Observer *,std::allocator<QuantLib::Observer *> > + [0] 0x19ef7e28 {iborIndex_={...} } QuantLib::Observer * + [1] 0x19ef7d58 {iborIndex_={...} } QuantLib::Observer * + [2] 0x19ef7c88 {iborIndex_={...} } QuantLib::Observer * + [3] 0x19ef7bb8 {iborIndex_={...} } QuantLib::Observer * + [4] 0x19ef7ae8 {iborIndex_={...} } QuantLib::Observer * + [5] 0x19ef7a18 {iborIndex_={...} } QuantLib::Observer * + [6] 0x19ef7948 {iborIndex_={...} } QuantLib::Observer * + [7] 0x19ef7878 {iborIndex_={...} } QuantLib::Observer * + [8] 0x19ef77a8 {iborIndex_={...} } QuantLib::Observer * + [9] 0x19ef76d8 {iborIndex_={...} } QuantLib::Observer * + [10] 0x19ef7608 {iborIndex_={...} } QuantLib::Observer * - [11] 0x19ef7538 {iborIndex_={...} } QuantLib::Observer * + [QuantLib::IborCoupon] {iborIndex_={...} } QuantLib::IborCoupon + __vfptr 0x627c5fc4 const QuantLib::IborCoupon::`vftable'{for `QuantLib::Observer'} * + observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} }) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable> > > - [12] 0x19ef7468 {iborIndex_={...} } QuantLib::Observer * + [QuantLib::IborCoupon] {iborIndex_={...} } QuantLib::IborCoupon + __vfptr 0x627c5fc4 const QuantLib::IborCoupon::`vftable'{for `QuantLib::Observer'} * + observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} }) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable> > > - [13] 0x19ef7398 {observables_=[3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} }) } QuantLib::Observer * - __vfptr 0x62780ee8 const QuantLib::Observer::`vftable' * [0] 0x61fd201c QuantLib::Observer::`vector deleting destructor'(unsigned int) * [1] 0x61fcd7b5 QuantLib::Observer::update(void) * + observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} }) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable> > > + pn {pi_=0x19eeb5d0 } boost::detail::shared_count The Call Stack: KernelBase.dll!761422a1() [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll] > QuantLibJNI.dll!QuantLib::Observer::update() Line 81 + 0x8 bytes C++ QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 130 + 0x31 bytes C++ QuantLibJNI.dll!QuantLib::InterestRateIndex::update() Line 94 C++ QuantLibJNI.dll!QuantLib::Observable::notifyObservers() Line 130 + 0x31 bytes C++ QuantLibJNI.dll!QuantLib::ObservableValue<QuantLib::Date>::operator=(const QuantLib::Date & t={...}) Line 81 C++ QuantLibJNI.dll!QuantLib::Settings::DateProxy::operator=(const QuantLib::Date & d={...}) Line 37 C++ QuantLibJNI.dll!Settings_setEvaluationDate(QuantLib::Settings * self=0x19d685a8, const QuantLib::Date & d={...}) Line 4384 C++ QuantLibJNI.dll!Java_org_quantlib_QuantLibJNI_Settings_1setEvaluationDate(JNIEnv_ * jenv=0x01ca4918, _jclass * jcls=0x003dfa4c, __int64 jarg1=433489320, _jobject * jarg1_=0x003dfa60, __int64 jarg2=433778680, _jobject * jarg2_=0x003dfa54) Line 24282 + 0xd bytes C++ 0243e772() jvm.dll!6d8e3a9c() The observable at index [2], an Euribor6M IborIndex, has 14 observers. I assume all of them should be IborCoupons. The observer at index 13 is recognized only as Observer, which seems odd, and it is also the observer in which update() fails (this == 0x19ef7398). It seems to me that it is not a fully constructed/destructed IborCoupon object. In my final Euribor6M index i expect 21 coupons. Best regards, Henner Heck ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
This is a bit of a long shot, but: Might be worth checking if there is a situation in which setEvaluationDate gets called from a constructor of an object? This probably isn't a good idea and could lead to partially constructed objects that you are seeing. Best, Bojan -- Bojan Nikolic || http://www.bnikolic.co.uk/ql ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
In reply to this post by Henner Heck
On Tue, 2011-01-04 at 19:29 +0100, Henner Heck wrote:
> Here is one quick scenario i got from the debugger [...] The observer > at index 13 is recognized only as Observer, which seems odd, and it is > also the observer in which update() fails (this == 0x19ef7398). It > seems to me that it is not a fully constructed/destructed IborCoupon > object. Yes, it seems so. Strange... Is there any chance that we can reproduce this in C++? Luigi -- No, I'm not interested in developing a powerful brain. All I'm after is just a mediocre brain, something like the president of American Telephone and Telegraph Company. -- Alan Turing on the possibilities of a thinking machine, 1943. ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hello all, >> Might be worth checking if there is a situation in which >> setEvaluationDate gets called from a constructor of an object? This >> probably isn't a good idea and could lead to partially constructed >> objects that you are seeing. Concluding from my code, it had to be partially deconstructed objects. The actual problem was the list of raw pointers "observers_" in the QuantLib::Observable class. It could happen, that the Java garbage collector, which is running in it's own thread, collects/destructs an observer object while an observable of this observer happens to be iterating over it's observers_ list. It could come across a partially deconstructed object (to the point where it becomes a QuantLib::Observer) which has no implementation of "update()" anymore except the pure virtual one of Observer. Therefore the "pure virtual function call" error happens. I first tried to resolve this by making the update() function not pure. That resolved this particular error, but now an "EXCEPTION_ACCESS_VIOLATION (0xc0000005)" occurred, probably because of messing around with the list structure while iterating over it.(?) My guess is, that this error could have appeared before also, but that the "pure virtual function call" was just much more probable. I also unsuccessfully tried some locking of functions, but in the end i chose to abandon the raw pointer list completely. My solution now is to use the "enable_shared_from_raw.hpp" from Boost in combination with Boost:signals2 to maintain trackable connections between Observer and Observable. It seems to work for my scenario. A loop of 20000 swapevaluations went through without crashing. Unfortunately "enable_shared_from_raw.hpp" is from the Boost trunk and not (yet?) part of the official releases. You can easily get it here (you'll need the "shared_ptr.hpp" too): http://svn.boost.org/svn/boost/trunk/boost/smart_ptr/ There will be some complaints from the compiler about ambiguous declarations in some anonymous namespaces and about inaccessible base class: /QuantLib/ql/pricingengines/vanilla/analytichestonengine.cpp replace "_1" with "boost::lambda::_1" replace "bind" with "boost::lambda::bind" /QuantLib/test-suite/inflationvolatility.cpp /QuantLib/test-suite/nthtodefault.cpp replace "smart_ptr" with "boost::smart_ptr" /QuantLib/ql/experimental/finitedifferences/fdmsimple2dbssolver.hpp make the inheritance from LazyObject in line 40 public: "class FdmSimple2dBSSolver : public LazyObject {" I attached the modified "observable.hpp", in case someone's interested to give it a try. The condition for it to work is that each Observer has to be under the control of a boost::shared_ptr when constructed. The mutex is not really needed in a "single thread +gc"-only scenario, but it didn't give me a noticeable performance decrease, so i kept it. Feel free to comment it out. The modified code passed the QuantLib 1.0.1 testsuite using Visual Studio Express 2008 (32 Bit compilation, release static) on Windows 7 Professional 64 Bit. Best regards, Henner Heck > On Tue, 2011-01-04 at 19:29 +0100, Henner Heck wrote: >> Here is one quick scenario i got from the debugger [...] The observer >> at index 13 is recognized only as Observer, which seems odd, and it is >> also the observer in which update() fails (this == 0x19ef7398). It >> seems to me that it is not a fully constructed/destructed IborCoupon >> object. > > Yes, it seems so. Strange... Is there any chance that we can reproduce > this in C++? > > Luigi > > ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev observable.hpp (8K) Download Attachment |
The lines regarding BOOST_NO_MEMBER_TEMPLATE_FRIENDS were leftovers. Attached is a cleaned version of "observable.hpp". ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev observable.hpp (8K) Download Attachment |
Free forum by Nabble | Edit this page |