In the past I have used version 1.3.3 and now I have updated to 1.36 because I also wanted to use the data library with SQLite.
I am using Linux and also static linked libraries.
But now I have a different behaviour of previous working parts.
One thing is the stability of the application after reboots sometimes I encounter exceptions.
A trace stack is below:
- Code: Select all
15 __cxa_throw() 0xb7e73e5d
14 Poco::MutexImpl::lockImpl() Mutex_POSIX.h:82 0x08053e5b
13 Poco::FastMutex::lock() Mutex.h:205 0x08053eaa
12 ScopedLock() ScopedLock.h:59 0x08053ecc
11 Poco::AtomicCounter::operator--() AtomicCounter.h:292 0x0805403b
10 Poco::RefCountedObject::release() RefCountedObject.h:102 0x0805407d
9 ~AutoPtr() AutoPtr.h:112 0x08056ff9
8 Poco::NotificationQueue::dequeueOne() NotificationQueue.cpp:210 0x082ca35c
7 Poco::NotificationQueue::waitDequeueNotification() NotificationQueue.cpp:106 0x082cade6
6 SUB_H248_GatewayControl_Task::runTask() sub_h248_gatewaycontrol.cpp:61 0x080e81a8
There is a mutex which can't be locked so that is an indication for me that the pointer is already released.
But in my application until now I haven't used AutoPtr but release the pointer myself after it was processed.
Processing the pointer means this is done after the waitDequeueNotification has returned.
Normally I have a receive thread which receives data from the network then this data is passed through Notifications to a message parser.
There the message parser creates different messages which are derived of the Notification class and send further to another thread through a Notification Queue.
One type of message I process and send it even further to another thread.
In the previous poco version this worked quite good, now with the 1.3.6 version there are sometimes exception.
At the moment my understanding is that this problem occurs because of the change from normal pointer to AutoPtr in the Notification.
It seems that a pointer is already released, in my code I release the Notifications only after they are processed so I don't understand why the Notification in that part should be released.
One point which I consider a problem is that I don't use an AutoPtr even with the received Notification which wasn't necessary in the previous Poco version.
I tried to implement this according to some examples, but then encountered another problem that with an AutoPtr polymorphisms is not possible anymore.
So how should I implement the following:
- Code: Select all
class Command : public Notification
class DerivedCommand : public Command
class DerivedCommand1 : public Command
AutoPtr<Command> message = pNf.cast<Command>();
As I understand I could do the cast for every message type that I expect. But that is not what I want I would prefer to use polymorphism.
Is there another explanation for the not to be able to lock the mutex?