segment-boneyard / nightmare

A high-level browser automation library.
https://open.segment.com
19.54k stars 1.08k forks source link

Freezing/Locking up afer running for several hours #1584

Open kingarawana opened 4 years ago

kingarawana commented 4 years ago

I seem to be running into an edge case issue. When I leave nightmare.js program running for several hours it would eventually stop working. As my program is running I log out which steps it's on. Eventually after several hours progress stops.

I would then kill the program and try to start it again, but same thing happens. The program gets stuck on running the nightmare.js module.

The only solution I've found was to restart my computer, after which the program seems to run fine again for another few hours.

Does any one have any suggestions on what I should do or look into to find out what might be wrong? Or what I can do narrow down the logs so I can share it with the community?

I tried adding "DEBUG=nightmare*" and I got the outputs, but it seems to continually try to start submitting to "queue" again, but there's no message about what's failing or any error messages.

MBP macOS Catalina nightmare: 3.0.2 node: 10.15.4

I've also ran this on my ubuntu server, and the same thing happens.

kingarawana commented 4 years ago

After more research, this seems to be an old issue that hasn't been fixed yet. This post gave the most thorough answer I could find.

I had to basically call child_process.exec('killall electron'); After the completion of each call. Apparently nightmare doesn't close electron sometimes. The majority of time that call will throw an exception simply because electron was closed properly. You could do something more elegant like check if it's still running, and call kill only if it is. I just caught it and ignored it for simplicity.

Not sure if you guys want me to close this or leave it open. I figure it's still an issue in the project so I'll leave it open until I hear otherwise.