nightmare-download-manager
nightmare-download-manager copied to clipboard
Nightmare runner error:Error: Object has been destroyed
Hi ! When using this package if after a download i don't end nightmare i have this crash. Here is the full log. How can i catch this error ? And how to fix it ? Thanks for your work on nightmare @rosshinkley
nightmare queueing action "waitDownloadsComplete" +0ms
nightmare running +0ms
nightmare:download-manager waitDownloadsComplete waiting for downloads to finish +0ms
nightmare:download-manager download AffichageResultats.pdf is updated: 0.00% +0ms
nightmare:download-manager download AffichageResultats.pdf is updated: 0.00% +0ms
nightmare:log waiting, elapsed: 100 +100ms
nightmare:log waiting, elapsed: 200 +104ms
nightmare:download-manager download AffichageResultats.pdf is updated: 100.00% +4ms
nightmare:download-manager download AffichageResultats.pdf is updated: 100.00% +1ms
nightmare:download-manager download AffichageResultats.pdf is updated: 100.00% +0ms
app:scripts Download Completed ! +35ms
app:scripts Putting in array.... +0ms
nightmare:download-manager download AffichageResultats.pdf is completed: 100.00% +1ms
nightmare:log waiting, elapsed: 300 +60ms
.......... a lot of nightmare:log waiting, elapsed: 4800 +106ms ...............
nightmare:log waiting, elapsed: 4800 +106ms
nightmare:log waiting, elapsed: 4900 +106ms
nightmare:download-manager download AffichageResultats.pdf is force-cancelled: 0.00% +101ms
nightmare:log no parent request received for download, discarding +1ms
Nightmare runner error:
Error: Object has been destroyed
at Error (native)
at Timeout.wait [as _onTimeout] (eval at <anonymous> (/Users/gautier/Documents/Projets/lifebox/server/node_modules/nightmare/lib/runner.js:543:14), <anonymous>:89:35)
at tryOnTimeout (timers.js:232:11)
at Timer.listOnTimeout (timers.js:202:5)
Snippet :
debug('Trying to download....')
await nightmare.click('a[title="click here"]')
debug('After click')
await nightmare.waitDownloadsComplete()
nightmare.on('download', async (state, downloadItem) => {
try {
if (state === 'started') {
nightmare.emit('download', '/tmp/resultats-' + started_at + '.pdf', downloadItem)
}
else if (state === 'completed') {
debug('Download Completed !')
debug('Putting in array....')
files_store.push({
type: 'file',
filename: 'resultats-' + started_at + '.pdf',
path: '/tmp/resultats-' + started_at + '.pdf',
mimetype: downloadItem.mimetype
})
debug('Downloaded : ', downloadItem)
}
}
catch(ex){
debug('ex in download : ', ex);
}
})
Sometimes, if the files are very small, the download will complete prior to the download pausing, which can cause problems as the underlying Electron event is already disposed. When the download manager attempts to resume the completed download, it's trying to hit a disposed object, and Electron crashes. It's a similar problem to the referenced Nightmare issue with a slightly different cause.
I thought I had all of the edge cases for this caught - when the download manager responds with how to handle the download, and if the download is complete, the manager should simply move the file and ignore the download object from Electron entirely.
Do you have a minimum repro where this still happens?
Hi @rosshinkley, It's on a private website so i can't make a minimum repro ... 😕 I will try to find you an access.
But in the meantime how can i catch the error ? Why try/catch failed to catch it ? Thanks !
+1 Any progress here?
+1 getting the same issue
Mine happens only with one wsdl file (CompetitorService.wsdl 10.1 KB ) .. anyone know how ca I avoid this?
Same issue.
What should we do with this?
Anybody any idea how to catch this error?
I have same question, anybody know how to solve this problem?
+1 getting the same issue
The solution for me was to install "libgconf-2-4" Since Chrome 42, is a dependency.
just
apt-get install libgconf-2-4
and test if you have troubles, launch your application with:
DEBUG=nightmare*,electron:* node app.js
@sebaplaza nope, that does not work. i'm still getting this error on small files.
Has anyone been able to solve this?
+1 getting the same issue