Hi,
I have come across a potential infinite loop in xerces....  When the
following occurs:

1) Inside XMLPlatform::Initialize, we create some mutexes.  When the Mutex
constructor code fails it does a throw.
2) The throw creates a new XMLException with some text.
3) The text is gotten from a message loader.
4) When the message loader is called the first thing it does is to lock its
own mutex.
5) Its mutex hasn't been created yet so it creates a new one.
6) The mutex constructor code tries to initalize (i.e., step 1 above) and
we are now looping.

My initial ideas to resolve this are:
1) If we fail on creating a mutex (or locking a mutex or unlocking a mutex:
I mention these as well since they could also lead to an infinite loop in
XMLException) panic instead of throwing an exception.
2) Add a counter to the XMLPlatform and keep track of the number of throws
for mutex errors and if the error is say greater than 6 then panic (as it
may indicate we are in a recursive state).
3) Modify XMLException.cpp so that gGetMsgLoader() checks what the message
(ie. is it a Mutex_CouldNotXXX) before trying to lock a mutex.
4) Creating another exception class similar to OutOfMemoryException that we
would throw for mutex errors.

I don't suspect this problem will occur very often (it was discovered with
a misaligned pointer that has since been corrected).  I am currently
leaning towards (1) but thought I should get feedback from other people
before making this change.  Anyone?

Regards,
David A. Cargill


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to