Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nightmare runner error:Error: Object has been destroyed #14

Open
GautierT opened this issue Mar 8, 2017 · 12 comments
Open

Nightmare runner error:Error: Object has been destroyed #14

GautierT opened this issue Mar 8, 2017 · 12 comments

Comments

@GautierT
Copy link

GautierT commented Mar 8, 2017

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);
	}
})

@rosshinkley
Copy link
Owner

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?

@GautierT
Copy link
Author

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 !

@Kinzi
Copy link

Kinzi commented Jun 28, 2017

+1 Any progress here?

@atorralb
Copy link

+1 getting the same issue

Mine happens only with one wsdl file (CompetitorService.wsdl 10.1 KB ) .. anyone know how ca I avoid this?

@mgroshevoy
Copy link

Same issue.

What should we do with this?

@Kinzi
Copy link

Kinzi commented Oct 11, 2017

Anybody any idea how to catch this error?

@quan-zai
Copy link

quan-zai commented Feb 8, 2018

I have same question, anybody know how to solve this problem?

@vijaypatoliya
Copy link

+1 getting the same issue

@sebaplaza
Copy link

sebaplaza commented Mar 29, 2018

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

@utkukaratas
Copy link

@sebaplaza nope, that does not work. i'm still getting this error on small files.

@cagdasdag
Copy link

Has anyone been able to solve this?

@fingerpich
Copy link

+1 getting the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests