I have followed the code in the link multiprocessing.Pool() slower than just using ordinary functions to write a multi process program, but I find when the length of data in mainwordlist is relatively large, the code can't work. (you can try by setting xrange(50) to xrange(1000) in the code)
Actually, the terminal interface shows that the code is still running, however, the process in top command is gone, can anyone tell me why? any comment will be appreciated. thank you!
I find the following link http://eli.thegreenplace.net/2012/01/16/python-parallelizing-cpu-bound-tasks-with-multiprocessing and reorganize my code. Both of them start from same method, but I avoid above problem though I still don't know why. Anyway, it works.
Related
I've followed this tutorial:
https://www.linode.com/docs/guides/start-service-at-boot/
and set everything up.
Since my problem is exactly this:
https://unix.stackexchange.com/questions/298027/restart-systemd-service-when-output-is-no-longer-generated
I've also followed the answers here.
The problem with the solution: after 7 hours of runtime, the program stuck. No output generated, systemd didn't restart it.
in my_service.service are both suggested mandatory entries
everything else is correct
WatchdogSec=30
Restart=on-watchdog
Can I manually make my Rust program communicate with systemd? And if yes - how? I'd love to make it notify systemd at particular lines periodically.
The docs couldn't be more minimal:
https://docs.rs/systemd/latest/systemd/daemon/constant.STATE_WATCHDOG.html
I don't understand a single thing..
Another example crate libsystemd, there's 3 search results for WatchDog and this one is the most relevant I guess.
https://docs.rs/libsystemd/latest/libsystemd/daemon/enum.NotifyState.html#variant.Watchdog
IDK how I am able to accomplish anything here. Do I just paste this line anywhere in the program that I want?
libsystemd::daemon::NotifyState
how will it know the PID?
In any case: each of those packages has multiple methods, and my program hangs after anywhere from 1-24 hours, trial and error might take weeks.
How can I make my Rust program communicate to the systemd from inside threads, or if impossible - just manually set it up and ensure the WatchDog receives the signal as I want it? What's the line of code for sending a single notification from Rust program to systemd?
As mentioned above the go-to logic is simple: if no print output, restart the program.
You have to send the message somehow. By looking for functions that use the NotifyState I found both systemd::daemon::notify and libsystemd::daemon::notify either of which will do.
For example:
use systemd::daemon::{notify, STATE_WATCHDOG};
notify(false, [(STATE_WATCHDOG, "1")].iter()).unrwap();
I'm trying to figure out exactly how nodejs tasks are run. I understand that there is a main loop that takes requests and then queues them up and moves on. What exactly then executes those queued up events/tasks?
Update:
Can somebody actually please explain it? I appreciate people wanting me to script it and figure it out myself, but sometimes it's better to just have it explained rather than creating barriers to learning simple concepts.
you can follow https://github.com/node-inspector/node-inspector
use can use node-inspector to select a script and set some breakpoints,help you to understand event loop,
My application is doing some heavy IO on raw /dev/sdb block device using pread64/pwrite64. Sometimes it doing just fine. Call to pread64/pwrite64 usually takes as little as 50-100us. But sometimes it takes a whole lot more, up to several seconds.
What can you recommend to find the cause of such problem?
I have not used it but I have heard about a tool called latencytop.
When it's hung like that, grab a stackshot. Another option is pstack or lsstack.
And as #Zan pointed out, latencytop could also give you that information.
That might not fully answer your question, but at least you'll know with certainty what it was trying to do when it was hung.
I've accidentally ran a script with an infinite loop in GroovyConsole. :-\
For the sake of Murphy's Law, I haven't save my work during 3 or 4 hours. So, before killing the GroovyConsole Process, I've dumped the heap, with the hope to find a String version of the Script that was running at this moment
Do you have a hint in which Class it can hide, or if it is possible ?
So, it happens that my guess was right. The groovy.ui.Console Object keeps an history of changes of the script. I give you the OQL query that gave me my script back for my greatest pleasure. I ran it in VisualVM with the OQL plugin, but I could have used jhat :
select x.history.elementData[x.history.elementData.length-2].allText.toString() from groovy.ui.Console x
Despaired groovy developers who've lost their code once might be releaved now :-) For sure I am
The string version of the script may exists in another object. I'd love to hear other solutions
Anytime I have a badly behaving process (pegging CPU, or frozen, or otherwise acting strangely) I generally kill it, restart it and hope it doesn't happen again.
If I wanted to explore/understand the problem (i.e. debug someone else's broken program as it's running) what are my options?
I know (generally) of things like strace, lsof, dmesg, etc. But I'm not really sure of the best way start poking around productively.
Does anyone have a systematic approach for getting to the bottom of these issues? Or general suggestions? Or is killing & restarting really the best one can do?
Thanks.
If you have debugging symbols of the program in question installed, you can attach to it with gdb and look what is wrong there. Start gdb, type attach pid where pid is the process id of the program in question (you can find it via top or ps). Then type Ctrl-C to stop it. Saying backtrace gives you the call stack, that means it tells which line of code is currently running and which functions called the currently running function.