Re: Console app freezes

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Michael--J (MichaelJ_at_discussions.microsoft.com)
Date: 12/16/04


Date: Thu, 16 Dec 2004 03:17:08 -0800

Thanks for your quick reply. I see what you are getting at. But how would a
race condition cause a hang? I thought it usually just corrupts the proper
value of an object or variable.

I'm getting quite worried because i have been working on this app for quite
some time now and to find out it can't last for long periods of time is
really disappointing. I just want to make sure whether things like this are
fixable or if it's inherent with running multithreaded apps on
resource-contrained devices. It's just very wierd that sometimes it runs for
hours (it ran for 10 hours once) and at other times it freezes after 20, or
30 mins or so. I'll have a look and see if i can find any race conditions.
Thanks in advance.

Michael--J.

"Ilya Tumanov [MS]" wrote:

> You probably have a race condition somewhere; this is the common reason for
> multithreaded applications to hang.
>
> Make sure all shared (between threads) objects are properly locked/unlocked.
>
>
>
> Best regards,
>
>
>
> Ilya
>
>
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Michael--J" <MichaelJ@discussions.microsoft.com> wrote in message
> news:2A88D523-2302-4891-943E-2170F347100A@microsoft.com...
> > Hi,
> >
> > I've written a C# console app that does a lot of things simultaneously.
> > The
> > device being used is an FB6500
> > (http://www.fabiatech.com/products/fb6500.htm)
> > running Windows CE 5.0. These are all the things the app does:
> >
> > 1. Uses four threads to scan four COM ports - each port processes real
> > time
> > data composed of packets. These packets are on average 25 bytes long and
> > throughput is around 15 packets/sec. So all ports combined process 60
> > packets/sec.
> >
> > 2. Opens two network sockets - 1 for sending data and another for
> > receiving.
> > The receiving socket listens for incoming commands from a connected
> > client.
> >
> > 3. Uses 3 timers - one which runs every 10 seconds sends 1500 bytes of
> > data
> > through a socket to a connected client, another which runs every minute
> > checks the status of certain variables, and the third runs every hour and
> > uses RDA (remote data access) to synchronize a remote SQL Server 2000
> > database.
> >
> > 4. Keeps a log of things that may happen by keeping a file open and
> > writing
> > to it when necessary.
> >
> > I also need to run a client on a desktop PC which connects to the
> > listening
> > socket of the app on the device. This client simply receives the 1500
> > bytes
> > of data every ten seconds and updates a form. When running the app on the
> > device, it works fine functionally but I have noticed that a lot of times
> > the
> > console app freezes after a while (the mouse is still movable but I can't
> > press anything, the system time at the bottom right corner also freezes).
> > I
> > ran it overnight last night and this morning when I checked it, it was
> > still
> > running. I then ran it again and after 20 mins or so it freezes. The
> > amount
> > of time it takes until it freezes is unpredictable. The funny thing is
> > when
> > running it under VS.NET debug mode, after the app freezes, the serial
> > processing is still taking place, it's the networking stuff that's stopped
> > (i.e. the client no longer receives the 1500 bytes every ten secs). Would
> > the
> > number of threads running cause this freezing to take place? I honestly
> > don't
> > know where to begin to fix this problem. My app NEEDS to run for long
> > periods
> > of time (i.e. over 12 hours). Can anyone shed any light on what might be
> > causing this or where I should start looking? Thanks in advance.
> >
> > Kind Regards,
> >
> > Michael--J
>
>
>



Relevant Pages

  • Re: Writing Files asynchronously
    ... > I have a classic app that uses FSWrite to store text into a file. ... > app will hang indefinitely. ... > So I went looking for a way to kill off the pending I/O request. ...
    (comp.sys.mac.programmer.codewarrior)
  • Where to get updated wininet.pas/dll?
    ... Have an app in D7 that downloads a file every N minutes. ... Since in some rare cases the download will just hang and resulting in my app ... BlockWrite(f, Buffer, BufferLen); ...
    (alt.comp.lang.borland-delphi)
  • Writing Files asynchronously
    ... I have a classic app that uses FSWrite to store text into a file. ... I would like to work around the hang condition so I thought I'd convert ... I got the PBWriteAsync call to work to a point. ...
    (comp.sys.mac.programmer.codewarrior)
  • Re: Writing Files asynchronously
    ... > I have a classic app that uses FSWrite to store text into a file. ... > app will hang indefinitely. ... > I got the PBWriteAsync call to work to a point. ...
    (comp.sys.mac.programmer.codewarrior)
  • Re: Console app freezes
    ... These are all the things the app does: ... > through a socket to a connected client, ... the system time at the bottom right corner also freezes). ...
    (microsoft.public.dotnet.framework.compactframework)