hi all, i have a software written in vb.net which has many thread in it.
The software basically use about 8 threads to monitor in coming data
from serial port,
and some other thread that process those data.
What happen is the software will suddenly "dissapear" after running for
some time.
theres no error message or anything, it just end by itself.....
I wondering anyone got this kind of experience before ?
any clue someone ?
I am loosing my hair.... sigh.. 15 2986
Alright,
Well, this could be 1 of 1,000,000,000 issues probably. A little vague, but
thats ok. =)
A few questions, especially when your talking about using 8 threads on a
serial port...
1) Why are you using 8 threads to monitor a serial port? You should only
need 1 (depending on what your doing, I really don't see a reason for more,
in fact, I could see problems with this... Especially depending on what your
doing with this data coming from the port. What kind of syncronization are
you using? SyncLock? Muting? Roll your own?
Explain a little more what your doing, and I'll do my best to help you out.
As I've learned from countless people in here, when your using
multi-threading, make sure you have a reason. =)
I think the overall answer you'll be looking for is, 1 thread to monitor and
many to process long functions etc. But the reason its dying *could* be an
unmanaged code issue, I don't know, I have no idea what your code is nor how
your accessing the serial port (API I presume?)
Let me know.
CJ
"aikwee" <ai****@streamyx.com> wrote in message
news:O0**************@tk2msftngp13.phx.gbl... hi all, i have a software written in vb.net which has many thread in it.
The software basically use about 8 threads to monitor in coming data from serial port,
and some other thread that process those data.
What happen is the software will suddenly "dissapear" after running for some time.
theres no error message or anything, it just end by itself.....
I wondering anyone got this kind of experience before ?
any clue someone ?
I am loosing my hair.... sigh..
Hi,
I presume that each thread monitors a separate serial port?
If there are no errors (are you sure you aren't discarding a possible error
by a higher-level error trap), then it will be very hard to find. Offhand,
I don't have any suggestion. These things require hands-on debugging --
we'd just be guessing without having code to examine.
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
However... If you are sending data from the threads into an STAThread
process (such as the UI), then you need to marshal the data properly,
otherwise you will experience random failures. You do this by using
Control.Invoke or Control.BeginInvoke.
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:Ob**************@TK2MSFTNGP09.phx.gbl... Alright,
Well, this could be 1 of 1,000,000,000 issues probably. A little vague,
but thats ok. =)
A few questions, especially when your talking about using 8 threads on a serial port...
1) Why are you using 8 threads to monitor a serial port? You should only need 1 (depending on what your doing, I really don't see a reason for
more, in fact, I could see problems with this... Especially depending on what
your doing with this data coming from the port. What kind of syncronization
are you using? SyncLock? Muting? Roll your own?
the fact is i am monitoring 8 serial ports.
Explain a little more what your doing, and I'll do my best to help you
out. As I've learned from countless people in here, when your using multi-threading, make sure you have a reason. =)
I think the overall answer you'll be looking for is, 1 thread to monitor
and many to process long functions etc. But the reason its dying *could* be
an unmanaged code issue, I don't know, I have no idea what your code is nor
how your accessing the serial port (API I presume?)
i am using the vb.net example for acessing serial port as a model for my
program,...
i see a lot of api calls, is it the root of the problem ? Let me know.
CJ
"aikwee" <ai****@streamyx.com> wrote in message news:O0**************@tk2msftngp13.phx.gbl... hi all, i have a software written in vb.net which has many thread in it.
The software basically use about 8 threads to monitor in coming data from serial port,
and some other thread that process those data.
What happen is the software will suddenly "dissapear" after running
for some time.
theres no error message or anything, it just end by itself.....
I wondering anyone got this kind of experience before ?
any clue someone ?
I am loosing my hair.... sigh..
"Dick Grier" <di**************@msn.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi,
I presume that each thread monitors a separate serial port?
absolutely right....
If there are no errors (are you sure you aren't discarding a possible
error by a higher-level error trap), then it will be very hard to find.
Offhand, I don't have any suggestion. These things require hands-on debugging -- we'd just be guessing without having code to examine.
oops, i didn't handle all error properly... i presume
try .. catch.. end try = on error resume next
what will happen to unhandled error ? -- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
hi,
"Dick Grier" <di**************@msn.com> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl... However... If you are sending data from the threads into an STAThread process (such as the UI), then you need to marshal the data properly, otherwise you will experience random failures. You do this by using Control.Invoke or Control.BeginInvoke.
oh... i did update some UI but for debugging purposes, my porgram suppose to
run headless...
If you are sending data from the threads into an STAThread process (such as the UI), then you need to marshal the data properly,
this look like alien language to me.... do you have a pointer to a good
reference... ? -- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
On error resume next doesn't work anymore. Thats the way you use Try Catch
Finally Statements...
Unhandled errors depends on how you catch...
if you catch System.Exception, you'll catch *everything* that could go wrong
(good approach for testing). and then recover.
As far as monitoring 8 different serial ports, are you writing data back to
"primary" thread? Thats why I was asking about your syncronization.
-CJ
-CJ
"aikwee" <ai****@streamyx.com> wrote in message
news:Ou**************@tk2msftngp13.phx.gbl... "Dick Grier" <di**************@msn.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hi,
I presume that each thread monitors a separate serial port? absolutely right....
If there are no errors (are you sure you aren't discarding a possible error by a higher-level error trap), then it will be very hard to find. Offhand, I don't have any suggestion. These things require hands-on debugging -- we'd just be guessing without having code to examine.
oops, i didn't handle all error properly... i presume try .. catch.. end try = on error resume next
what will happen to unhandled error ?
-- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
thanks for repling.. On error resume next doesn't work anymore. Thats the way you use Try
Catch Finally Statements...
Unhandled errors depends on how you catch...
if you catch System.Exception, you'll catch *everything* that could go
wrong (good approach for testing). and then recover.
i do :
Try
....some codes here
catch ex as exception
`doesn't do anything here
end try
in a thread so that it will recover and run on and on again....
is it right ?
As far as monitoring 8 different serial ports, are you writing data back
to "primary" thread? Thats why I was asking about your syncronization.
i presume what you mean by "primary thread" is the thread that start the 8
threads....
no , 8 serial ports threads don't write back to main thread, the just put
the data in a class
for other processes to read (only)
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... On error resume next doesn't work anymore. Thats the way you use Try
Catch Finally Statements...
Unhandled errors depends on how you catch...
if you catch System.Exception, you'll catch *everything* that could go
wrong (good approach for testing). and then recover.
As far as monitoring 8 different serial ports, are you writing data back
to "primary" thread? Thats why I was asking about your syncronization.
-CJ
-CJ "aikwee" <ai****@streamyx.com> wrote in message news:Ou**************@tk2msftngp13.phx.gbl... "Dick Grier" <di**************@msn.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hi,
I presume that each thread monitors a separate serial port? absolutely right....
If there are no errors (are you sure you aren't discarding a possible error by a higher-level error trap), then it will be very hard to find. Offhand, I don't have any suggestion. These things require hands-on
debugging -- we'd just be guessing without having code to examine.
oops, i didn't handle all error properly... i presume try .. catch.. end try = on error resume next
what will happen to unhandled error ?
-- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications,
3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
"aikwee" <ai****@streamyx.com> wrote in message
news:eI**************@TK2MSFTNGP11.phx.gbl... thanks for repling..
not a problem On error resume next doesn't work anymore. Thats the way you use Try Catch Finally Statements...
Unhandled errors depends on how you catch...
if you catch System.Exception, you'll catch *everything* that could go wrong (good approach for testing). and then recover.
i do : Try ...some codes here catch ex as exception `doesn't do anything here end try
in a thread so that it will recover and run on and on again.... is it right ?
Right. As far as monitoring 8 different serial ports, are you writing data back to "primary" thread? Thats why I was asking about your syncronization.
i presume what you mean by "primary thread" is the thread that start the
8 threads....
Yeah. exactly.
no , 8 serial ports threads don't write back to main thread, the just put the data in a class for other processes to read (only)
Thats where you might want to use some SyncLocking of some kind. Deny
another thread the rights to read or write from here becaues you could have
some data issues.. Maybe, maybe not, I'm just anal that way and like to
have it that way. You still have communication between 2 threads through
this class (whether it goes directly back to the primary thread or not) in
which case you can still get some errors or inaccurate data.
"CJ Taylor" <no****@blowgoats.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... On error resume next doesn't work anymore. Thats the way you use Try Catch Finally Statements...
Unhandled errors depends on how you catch...
if you catch System.Exception, you'll catch *everything* that could go wrong (good approach for testing). and then recover.
As far as monitoring 8 different serial ports, are you writing data back to "primary" thread? Thats why I was asking about your syncronization.
-CJ
-CJ "aikwee" <ai****@streamyx.com> wrote in message news:Ou**************@tk2msftngp13.phx.gbl... "Dick Grier" <di**************@msn.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... > Hi, > > I presume that each thread monitors a separate serial port? > absolutely right....
> If there are no errors (are you sure you aren't discarding a
possible error > by a higher-level error trap), then it will be very hard to find. Offhand, > I don't have any suggestion. These things require hands-on debugging -- > we'd just be guessing without having code to examine.
oops, i didn't handle all error properly... i presume try .. catch.. end try = on error resume next
what will happen to unhandled error ?
> > -- > Richard Grier (Microsoft Visual Basic MVP) > > See www.hardandsoftware.net for contact information. > > Author of Visual Basic Programmer's Guide to Serial Communications, 3rd > Edition ISBN 1-890422-27-4 (391 pages) published February 2002. > >
Hi,
On Error Resume Next STILL works. Check it out. As always, it skips all
errors in scope. This is equivalent to a Try/Catch/End Try block that has
no code to trap an exception in the Catch section.
The problem is that either of these may skip an valuable exception. And, of
course, you can write Catch code that doesn't trap the exception of
interest, thus causing a logical failure that remains unexplained.
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
Hi,
The UI is STAThread (Single Apartment Threaded). The Microsoft references
for Threading describe what you need to do to write from a free thread to an
STAThread code module. The example code that they show involves updating a
ListView control, I think. However, the requirements are the same
regardless, when your threaded code calls code in an STAThread (UI).
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
Hi,
On Error Resume Next STILL works. Check it out. As always, it skips all
errors in scope. This is equivalent to a Try/Catch/End Try block that has
no code to trap an exception in the Catch section.
The problem is that either of these may skip an valuable exception. And, of
course, you can write Catch code that doesn't trap the exception of
interest, thus causing a logical failure that remains unexplained.
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
Hi,
The UI is STAThread (Single Apartment Threaded). The Microsoft references
for Threading describe what you need to do to write from a free thread to an
STAThread code module. The example code that they show involves updating a
ListView control, I think. However, the requirements are the same
regardless, when your threaded code calls code in an STAThread (UI).
--
Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
thanks guys, i guess i have to dig deepper to find what's going on....
"Dick Grier" <di**************@msn.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Hi,
The UI is STAThread (Single Apartment Threaded). The Microsoft references for Threading describe what you need to do to write from a free thread to
an STAThread code module. The example code that they show involves updating
a ListView control, I think. However, the requirements are the same regardless, when your threaded code calls code in an STAThread (UI).
-- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
HI, I found out that is the RS232 Class that have causing me problem. It
happen when i use it with
..Workingmode = overlapped
"aikwee" <ai****@spammer.com> wrote in message
news:uX**************@TK2MSFTNGP10.phx.gbl... thanks guys, i guess i have to dig deepper to find what's going on.... "Dick Grier" <di**************@msn.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... Hi,
The UI is STAThread (Single Apartment Threaded). The Microsoft
references for Threading describe what you need to do to write from a free thread
to an STAThread code module. The example code that they show involves
updating a ListView control, I think. However, the requirements are the same regardless, when your threaded code calls code in an STAThread (UI).
-- Richard Grier (Microsoft Visual Basic MVP)
See www.hardandsoftware.net for contact information.
Author of Visual Basic Programmer's Guide to Serial Communications, 3rd Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ajikoe |
last post by:
Hello,
Is anyone has experiance in running python code to run multi thread
parallel in multi processor. Is it possible ?
Can python manage which cpu shoud do every thread?
Sincerely Yours,...
|
by: Jon Skeet [C# MVP] |
last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the
article on all the groups this is posted to.
I've finally managed to finish my article on multi-threading - at least
for...
|
by: Stuart Norris |
last post by:
Dear Group,
I am attempting to write a "splash" and "status" Form using a second
thread.
I wish to use this Form to display status information to the user when
I do CPU intensive work in my...
|
by: notregister |
last post by:
my program have as many as 8 threads running at a same time. can different
threads open a same file at the same time? let say thread1 open a file
abc.txt at the same time with thread 2, both doing...
|
by: NiponW |
last post by:
Hi,
I have SQL SERVER 2000 SP4 Enterprise , Windows 2003
Enterprise on
Xeon 4 Processors (now with multi-threading CPU) and I have
questions which
seem weirds to me (used to have the same...
|
by: dotyet |
last post by:
Hi Everyone,
It would be a real big help if anyone can shed light on whether DB2 UDB
8.2 on Solaris will make optimum use of a Sun T2000 server. The server
has 1 CPU with 8 cores and each core...
|
by: ammoos |
last post by:
hi friends
pls help me.. i got an assignment which i feel very difficult to me.. i dont have more knowledge about multi-threading in .net...
the assignment details is below.... pls help me... i...
|
by: Akihiro KAYAMA |
last post by:
Hi all.
I found cooperative multi-threading(only one thread runs at once,
explicit thread switching) is useful for writing some simulators.
With it, I'm able to be free from annoying mutual...
|
by: George Maicovschi |
last post by:
As multi-threading is not built in PHP I've been using a hack letting
the Apache server handle the multi-threading issues, but I'm really
curious of other approaches to this issue.
If anyone has...
|
by: =?Utf-8?B?QU1lcmNlcg==?= |
last post by:
Sorry this is so long winded, but here goes. Following the model of
http://msdn2.microsoft.com/en-us/library/system.runtime.remoting.channels.ipc.ipcchannel.aspx
I made a remote object using the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |