[comp.os.os2.programmer] OS/2 message queues killing processes

djm5g@virginia.edu (David John Marotta) (05/21/91)

We have been having a unique problem that I thought you might have had
some experience with, and could give us some clues about its source.
Our program sends some initialization messages which synchronize the
startup of various threads within the program.  Recently the program has
been failing to startup, and the later messages never being received in
the main message queue.  Increasing the queue size from the default to
100 processed further.  Taking code out of one message and shortening the
amount of processing done in that message got us through that message
(whereas before it would die in the middle).  It would die at a given
TIME of processing, seemingly no matter what was being done.

Is there some sort of limitation on the amount of time a message can take
in order to process without being killed.  The time involved in these
messages is short (a few seconds), but when one process is done it posts
the start of the next process and there are about seven in total.  I have
only been able to think of two theories, but neither of them is
satisfactory: 1. The message queue is overflowing and important system
messages are being lost halting the system. 2. There is a time limit on
the amount of time a message can take, after this limit the processing is
killed (perhaps with a quit message? Codeview shows _a_msg_exit).

d88-pfo@dront.nada.kth.se (Peter Forsberg) (05/22/91)

If I get your problem right it is approximately the following (in summary):

You have a PM program, that processes some initialization message (system
or user defined, doesn't really matter). If this message processing takes
too long time (a few seconds...), you get the "Program not responding..." 
dialog, which presents you with an option to end the program.

If your situation is the one above, the problem probably is that the
message processing time is too long. The recommended maximum time for
processing any PM message is 1/10 second. If you have work which will take
more time (a few seconds), you should create a separate thread to do that
work, letting the message processing thread return control to PM. The
reason for this is in the design of PM, which cannot pass on several types
of messages to other windows until you have finished your message processing.

Hope this helps...

/ Peter
--
Peter A. Forsberg
Royal Institute of Technology, Stockholm, Sweden.
IBM Sweden, Banking & Finance Applications.
E-mail: d88-pfo@nada.kth.se
#include <standard.disclaimer>

larrys@watson.ibm.com (05/22/91)

_a_msg_exit() is one of those nasty procedures that MS put in that kills
your program when it does something nasty.  Another example:  do a divide
by zero in a PM program.  You don't get a trap, you don't get any beeps,
you get nothing.  Your application just disappears ("Look ma, no
hands!")!  Check your code, and variable values, and make sure that
nothing is done in any thread that might be considered "naughty".

Cheers,
Larry Salomon, Jr. (aka 'Q')            LARRYS@YKTVMV.BITNET
OS/2 Applications and Tools             larrys@ibmman.watson.ibm.com
IBM T.J. Watson Research Center         larrys@eng.clemson.edu
Yorktown Heights, NY

Disclaimer:  The statements and/or opinions stated above are strictly my
own and do not reflect the views of my employer.  Additionally, I have a
reputation for being obnoxious, so don't take any personal attacks too
seriously.