473,396 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

BUG trace realtime

How would you approach the following?
In a multithreaded realtime data acquisition system (all python v2.4),
after hours of running without a snag, without warning python hangs at
once without leaving any error message or error traceback at all. After
the incident, the OS itself (linux) appears to remain fully functional.
Thank you!
malv

Dec 29 '05 #1
4 1502
malv wrote:
How would you approach the following?
In a multithreaded realtime data acquisition system (all python v2.4),
after hours of running without a snag, without warning python hangs at
once without leaving any error message or error traceback at all. After
the incident, the OS itself (linux) appears to remain fully functional.


1. Define "hangs" more precisely. It's rare that an app can hang
without any behaviour that can tell you something more about it. For
example, can you Ctrl-C out of it? Does it have sockets open still? Is
it using any CPU time? etc... While you're at it, define "realtime"
too, since many people use it incorrectly and it might mean something
different to you than it does to everyone else reading it...

2. Use logging. "import logging" and proceed from there... without
logging, you have no idea where the problem occurred, and are going to
spend lots of time guessing where the cause is.

3. Make sure you are using Queues exclusively for inter-thread
communication.

4. Consider whether your external source of data (assuming there is one)
is the cause. How are you interfacing to it? Serial port? ctypes?
Something SWIGged for Python? A true "hang" is much more likely in an
external package than in Python code.

5. Tell us more about the platform. Which Linux (including version),
does it have a GUI, what's the basic architecture of the app as it
relates to the threading and data acquisition stuff, etc. (Of course,
the problem might not come from threads or data acquisition, but until
we learn more who could say?)

-Peter

Dec 29 '05 #2
Hi Peter,
Thank you for your extensive reply.
In the meantime, I solved the problem. I had started out to trace the
path of the randomly arriving external data through the different
threaded processing stages. After one of those 'hangs', with some luck,
I was able to spot the cause of the trouble: a piece of old code that
wasn't supposed to be out there! Really dumb.
FYI, to my surprise, Python really quit. No more CPU time, no message,
nothing. I can't recall having seen this before. You are quite right
about queues. I use these extensively and carefully. This kind of
enabled me to trace the path of the externally triggered events without
too much of a hassle.
Thanks again,
malv

Dec 29 '05 #3
malv wrote:
After one of those 'hangs', with some luck,
I was able to spot the cause of the trouble: a piece of old code that
wasn't supposed to be out there! Really dumb.
FYI, to my surprise, Python really quit. No more CPU time, no message,
nothing. I can't recall having seen this before.


If you post the relevant "old code" it's very likely someone could point
out exactly why it failed, and how it wasn't *Python* that "quit", but
merely something in your code that was blocking. (In other words,
Python probably did exactly what you told it to do.)

In general, Python does not "quit". It's very robust. When you get a
failure like that, always suspect your own code structure.

-Peter

Dec 29 '05 #4
What happened in fact was that a graphics plotting function for
monitoring got called twice frorm a different thread, due to an 'old'
instruction inadvertently left. Due to the quasi random nature of the
incoming data streams, this happened rather very sparingly. As the
plotting itself involves quite a bit of code, there are probably
several if not many reasons why problems could arise. It was never my
intention to reenter this function and make it thread safe. Problem
solved.

I was indeed a surprise for me to see Python quit this way.
Thanks again for your commentary.
malv

Dec 29 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rushikesh Joshi | last post by:
I have really no any idea how can i trace the error that are generated at runtime. Like invalide arguments, error in type conversion, user already registered, user deactive.. This fault strings...
0
by: Joe | last post by:
Hii Can anybody tell me how good is developing realtime applications in .NET Is writing managed code for realtime performance critical applications advisable? Thanks in advance, Joe
10
by: Rafał | last post by:
Hi. Timer in C# not work, Thread + Loop + Sleep + DateTime.Now too not work (Process.Prioritet = RealTime) What i do wrong? Best regards. Rafal
6
by: aikwee | last post by:
is it possible to make a thread priority to realtime mode in vb.net ?
8
by: Bryan | last post by:
Does anyone have an example of an application that can connect to a running process and capture Trace.WriteLine calls like in SQL Server Profiler? I know that we can inherit from a TraceListener...
5
by: zl2k | last post by:
hi, all I am trying to moniter the runing of a program by printing out some characters in a line at each stage. say, //program part1 cout<<"part1 "; //program part2 cout<<part2 "; ....
1
by: CptDondo | last post by:
OK, let me explain what I am trying to do. I have an embedded PC that runs a httpd+php server and controls a machine. I have a browser front end that provides the HMI (human machine interface)...
0
by: noxs | last post by:
hello..im using vb.net,but my prob is i wanted to get data from a datagrid which contain a realtime data (using port reader).but the way of gettin it is by using parsing value which i get from the...
4
by: =?Utf-8?B?YXVsZGg=?= | last post by:
hello, i'm not sure if this is possible. i have a small VS 2005 C# windows application. it has a textbox and a button. once the user presses the button it fires off many tasks. i want to use the...
0
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...
0
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
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.