I have an interrupt in my code which sometimes works, and sometimes gives the following error message.
RuntimeError: <Process(executeJobs) object at 0x7f3542880890> has terminated and cannot be interrupted.
I have checked that the object still exists, why am I still receiving this error?
I would also be glad to receive any other resources than http://simpy.readthedocs.org/ as I have already been through the documentation many times.
Thank you!
It looks like the Process instance still exists but is no longer alive. This means that the generator function that it executes (executeJobs in your case) is exhaused / has returned.
Related
I have a random Runtime Error 216 that appears on application close.
I have debugged as far as I can and the error is thrown in SysUtils.FinalizeUnits.
I have gone over the code and ensure all created objects are freed.
The number on the runtime error, 0040054A, is not present in the mapfile. Do you know what this means?
Can anyone tell me how to find out what is throwing the error?
This is VERY OLD Delphi problem - wrong exception handling in unit initialization/finalization process.
The problem easy to reproduce - just make any program error/exception (division by zero for instance) in initialization block of any unit. The exception will be created correctly. But then, before the exception rise, the unit finalization process destroy the exception object. And thus, when the exception object accessed, the "runtime error 216" occured.
I'd suspect a memory leak (all Runtime Errors 216 I've encountered so far were) and use a profiler (visual inspection is never as good as a tool). Since you're using Delphi XE, you should give AQTime a try (it's included), see also
Delphi - Check if memory is being released "on time"
Kind regards, Frank
Since runtime error 216 is an access violation, this may indicate that you're attempting to use something that you've already freed.
Addresses in the map file are based at 0, but that's not where your EXE file gets loaded into memory. Your EXE gets loaded at its preferred base address, which is usually $400000. Subtract that from the address you have. The address you're looking for in the map file is $0000054a.
There was a similar question, Read:
How to debug a crash that only occurs on application shutdown? (Delphi)
Consider using Memory profiler, this may help identifying live objects after app was terminitated.
I suggest you try the FastMM Full Debug Mode, and either statically link that into your app, or use it as a package (if your app uses packages).
You can use the method I used to fix mine.
I commented out the main program, and added code back until it failed.
Turns out that it did not want me to call couninitialize at all. Did not throw an error at the time, but failed after program termination with a 216. Removing the offending statement fixed it.
Since this was maybe 6 statements before end. statement, I don't imagine it will matter.
This method is easy if you are consistent about using // for comments. I moved IO statements that needed curly brackets to a procedure.
On Microsoft's oficial web site it is mentioned that, this issue can occur if your computer is infected with a SubSeven Trojan virus.
Antivirus software and windows registry cleaner should help.
The title says it all. I am using C++ Builder to submit a form to an Internet server using TIdHTTP->Post(), to get a response. Since that call can get stuck if there is a network problem or a server problem, I am trying to run it in a separate thread. When the Post() returns, I signal the Event that I am waiting for with WaitForSingleObject, using a timeout of 1000. At one point, I was processing messages after the timeouts, but now I am just repeating the WaitForSingleObject call with a timeout of 1000 again, until the event is signaled or my total timeout period (20 seconds) has elapsed. If the timeout elapses, I would call Disconnect() on the TIdHTTP and try again.
However, I have not been able to get this to work reliably, although it usually works. I am using CodeSite to log the progress, and I can see that, on occasion, WaitForSingleObject is called, but does not return (ever). Since WaitForSingleObject is being called on the main thread, the application is then unresponsive until it is killed.
While one must always think of memory corruption when a C++ program stalls, I don't think that is what is going on. The stall is always at the WaitForSingleObject call, and if it was a memory corruption issue, I would expect that, at least sometimes, something else would go wrong.
The MSDN page for WaitForSingleObject says that the timer does not count down while the computer is asleep, and the monitor does go blank after a while, but the computer continues to run, and in any case WaitForSingleObject does not return once the mouse is moved and the monitor comes back on.
So, again, my question. What could be causing WaitForSingleObject with a finite timeout (1000 msecs) to never return?
So, the answer to my question is "Something Else". In this case, I finally tracked it down to a library I was using that also used threads. It worked with a previous version of RAD Studio, but disabling that library fixed this issue. I am moving to the current version of that library and will re-test.
I had read about problems with WFSO causing blocks, and even where Sleep might never return if there were too many threads running (http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298(v=vs.85).aspx), so I thought there might be something I didn't know about threads and WFSO causing this.
Thanks to everyone for your helpful comments which pointed me in the right direction, and especially to Remy Lebeau for his suggestions on managing Post timeouts with Indy, which he maintains.
I hope you can help me or direct me to someone who can help me. I am programming in M(UMPS) and I am having a problem. In the program I am waiting for a response from the mainframe I do a read (R x:15) I understand that after 15 seconds if I did not get an answer I will stop waiting for an answer. I checked my $T and if it there is nothing there or if it is equal to zero I want to stop the program.
This works sometimes, but most often the program will abort prior to checking the $T, I don't even have a chance to see what is in x, how can I catch this before it aborts. I looked in the console log and everywhere but I do not see any error. The only error I see is when I look at the unsuccessful task it say err (getr+9 which is the line where I do my read.
R x:15 (IT STOPS HERE AND ABORTS if I run out of time)
I have tried
G:'$T END
OR
I '$T G END
OR
S TEST=$T
IF TEST=0 ..........
But none of these checks happen if I time out. If I do not time out everything works great.
By serendipity I ended up on this forum today.
So, maybe this question has been answered already. Anyway, here goes:
The answer to this question is that there can be multiple reasons why no response is received from a remote machine.
When it simply takes too long for the response to be transmitted, the following should work:
Read variable:15 If '$Test Goto ErrorHandler
However, when the communication channel between the two systems gets closed, this is treated as an error condition, so in that case, the following should work:
Set $ETrap="Goto ErrorHandler"
Read variable Set $ETrap="" ; Note that we don't need a time-out to handle this...
Hope this helps
Within my device driver, I am using wait_event_interruptible_timeout. How can I tell if a timeout has occurred? The macro only returns errorcode on interrupts but timeout is not an interrupt so "0" is returned.
Edit: not sure on how to tell if timeout occurred, but condition wont be set, so that sounds like the answer.
I ran into the same confusing issue a couple of weeks ago after reading the description of that function in Linux Device Drivers, Third Edition. Upon reading the comments for the various wait functions in a current kernel source tree, however, I found that the API has changed since the book was published. Newer kernels (at least 2.6.34+ and probably quite a bit further back than that), return the remaining number of jiffies to the timeout instead of an error code. So, a zero return value indicates the timeout occurred and any non-zero value should indicate a successful wakeup via the event condition. The comments in include/linux/wait.h provide a good description of the new API.
First, let me illustrate the steps to reproduce the 'bug'.
Create a new NSManagedObject.
Fault the managed object using refreshObject:mergeChanges:NO - At this time, the didTurnIntoFault notification is received by the object.
'Unfault' the object again by using willAccessValueForKey:nil - At this time, the awakeFromFetch notification is supposed to be received BUT NO NOTIFICATION COMES. All code relying of it firing fails, and the bread in the toaster burns :)
The interesting thing is that if I 'save' the managed object context before performing step 2, everything works okay and the awakeFromFetch notification comes as expected.
Currently the workaround that I am using is 'saving' the context at regular intervals, but that is more of a hack since we actually need to save the context once (when the application terminates).
Googling has so far returned nothing concrete, except a gentleman here that seems to have run into the same problem.
So my question is twofold - Is this really a bug, and if it is, then what other walkarounds (sic) do you suggest.
EDIT: THIS IS NOT A BUG BUT THAT WAS JUST ME BEING STUPID. See, if I turn an object to fault without saving it, then there is no history of the object to maintain. So in this case (i.e for an unsaved object) there is no logical concept of awakeFromFetch (since it was never saved). Please do let me know if I am still getting it all mixed up.
Anyways, turns out my 'actual' problem was somewhere else - hidden well behind 2 gotcha's
If you use refreshObject:mergeChanges:NO to turn an object to fault in order to break any retain cycles that core data might have established, you have to do the same for the child objects also - Each child object which might have gotten involved in a cyclic retain with someone else will have to be manually faulted. What I had (wrongly) assumed was that faulting the parent will automatically break the cycles amongst the children.
The reverseTransform function of your custom transformers will NOT be called when such a object (i.e. which has been forcefully faulted) is resurrected by firing a fault on it. This in my eyes IS a bug, since there is no other way for me to know when the object is alive again. Anyways, the workaround in this case was to set the staleness interval to an arbitrarily low value so that core data skips its cache and always calls the reverseTransform function to resurrect the object. Better suggestions are welcome.
it really has been one of those days :)