OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Death by MessageBox
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Death by MessageBox


  • To: NTBUGTRAQLISTSERV.NTBUGTRAQ.COM
  • Subject: Death by MessageBox
  • From: chefren <chefrenPI.NET>
  • Date: Sun, 11 Apr 1999 22:50:25 +0200
  • Approved-By: Russ.CooperRC.ON.CA
  • In-Reply-To: <3710D929.D6E46401dds.nl>
  • Posted-Date: Sun, 11 Apr 1999 22:50:27 +0200 (MET DST)
  • Priority: normal
  • Reply-To: chefren <chefrenPI.NET>
  • Sender: Windows NT BugTraq Mailing List <NTBUGTRAQLISTSERV.NTBUGTRAQ.COM>

..

> -------- Original Message --------
>     "NT hangs when several threads are calling MessageBox"
>
> Date: Fri, 9 Apr 1999 13:23:45 -0400
> From: "Sumner, Jeff" <sumnerbassinc.com>
> Organization: OARnet
> Newsgroups: microsoft.public.win32.programmer.kernel
>
> Hello,
>
> We have a server app that has several clients attached to it.  When
> certain conditions happen on a client, the server app spawns a new
> thread that simply calls MessageBox.  The thread is created so the main
> server thread can still be processing when the message box is displayed.
> We have found that when 16 of these threads are created, NT pretty much
> hangs until a few of the message boxes are closed.
>
> I have written a test program to recreate this, and have noticed the
> exact same behavior.  The test program is a console app that takes an
> integer parameter for the number of message boxes to pop up.  I ran this
> test app while I have the NT performance monitor up.  Any number up to
> 15 works fine, but as soon as I specify 16 or higher, the task manager
> stops dead cold until a couple of the message boxes (and subsequent
> threads) are closed.   The code for the test program is less than 3K, so
> I've included it here.
>
>  <<MessageBoxTest.cpp>>
> I have figured something out since I posted the message.  The
> MB_SERVICE_NOTIFICATION flag given to MessageBox is causing the problem.
> This flag allows an NT service to display a message box, regardless of
> who is logged in.  The box will still display even if nobody is logged
> in.  However, NT does not like the 16th box at all.
>
> If I take this flag out, then each message box is created with its own
> window, and each one appears in the task bar, but only if the "Allow
> Service to Interact with Desktop" option is enabled for the service
> under Control Panel | Services.  In this case, NT performs fine when
> more than 15 message boxes are specified, but no message boxes will be
> displayed if nobody is logged in.
>
> So, to make the long story short, I am thinking that there is a bug in
> NT that causes windows messages to not be processed correctly when
> MB_SERVICE_NOTIFICATION is used and the 16th window is popped up.
>
> Another thing we have tried is scrapping the multithreading and
> MessageBox altogether and just making a system call to execute "net send
> <machinename> <message>", which causes the message to pop up in a window
> on the specified machine (as long as the NT Messenger service is
> running).  The drawback to this is that it appears that the messenger
> service only accepts 6 messages at a time.  All others get dropped on
> the floor until one or more of the first 6 are closed.
>
> Does anybody have any insights?  They would be greatly appreciated.
>
> Thanks for your time.
>
> Jeff Sumner
> BASSpoiNT Development
> BASS, Inc.
> sumnerbassinc.com


We "tested" it and it "works"...

+++chefren