Error handling in eConsoleAppContainer
Re: Error handling in eConsoleAppContainer #41
Posted 20 November 2018 - 16:49
Re: Error handling in eConsoleAppContainer #42
Posted 21 November 2018 - 01:44
There is little in the way of error handling in most uses of eConsoleAppContainer, whether used directly by the Python code or via Components.Console. I thought it useful to provide as much error feedback as reasonable in the hope that something might get displayed by the class user.
Would something like:
char fail_str[] = "Failed to run "; write(2, fail_str, sizeof fail_str - 1); write(2, cmd, strlen(cmd)); write(2, " - ", 3); write(2, strerror(errno), strlen(strerror(errno))); write(2, "\n", 1);
be OK?
Re: Error handling in eConsoleAppContainer #43
Re: Error handling in eConsoleAppContainer #44
Re: Error handling in eConsoleAppContainer #45
Re: Error handling in eConsoleAppContainer #46
Posted 22 November 2018 - 11:47
"Blocking the main thread?" for 5 tiny writes? Shall I time how long they take?
It's about how long they *might* take. Writing to a file handle *may* block indefinitely. I can create a situation where something like "int *i; *i++;" takes about 2 seconds to complete. Exceptional, yes. But it does happen.
The point is, something's wrong, and you don't want to make it worse. If that execvp failed for any other reason than the executable being not executable, all you want to do is exit that process as quickly as possible and give the OS the chance to clean up the mess.
Re: Error handling in eConsoleAppContainer #47
Posted 22 November 2018 - 20:40
And RTFM as well. Check what vfork() is all about. You really can't do anything between the vfork() and the execve(). It's very clearly stated. If there wasn't such a restriction, we would be using vfork() all of the time. Everything that comes cheap has it disadvantages. It's not about the time you spend, it's about the amount of shared process memory you change. Every statement adds to it and it's wrong, it will give problems.
* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.
Re: Error handling in eConsoleAppContainer #48
Re: Error handling in eConsoleAppContainer #49
Re: Error handling in eConsoleAppContainer #50
Posted 28 November 2018 - 19:47
What shared process memory do those 5 write statements change?
Take a look at the assembly output of the C compiler and also watch all libc functions that are called... You'll see not only a few but A LOT.
* Wavefrontier T90 with 28E/23E/19E/13E via SCR switches 2 x 2 x 6 user bands
I don't read PM -> if you have something to ask or to report, do it in the forum so others can benefit. I don't take freelance jobs.
Ik lees geen PM -> als je iets te vragen of te melden hebt, doe het op het forum, zodat anderen er ook wat aan hebben.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users