GithubHelp home page GithubHelp logo

Daemon problem? Might be me. about pychrome HOT 12 CLOSED

fate0 avatar fate0 commented on May 21, 2024
Daemon problem? Might be me.

from pychrome.

Comments (12)

fate0 avatar fate0 commented on May 21, 2024 1

I can reproduce this problem for now, I am thinking how to fix it ...

from pychrome.

fate0 avatar fate0 commented on May 21, 2024

I can not reproduce this problem. actually, this is quite weird, your queue module seems to be a NoneType object.

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

You have to use the gist provided, and a URL that will timeout to replicate the problem. Has to be run a few times to show up once.

I'm using this to run the file: python app.py --urls=https://google.com,https://ebay.com,https://facebook.com,https://sasadacxzcsadsa.com --force-kill=True --timeout=5

It doesn't always show that error, for example, this time it's showing this:

Exception in thread Thread-10:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/pychrome/tab.py", line 158, in _handle_event_loop
logger.error("[-] callback %s error: %s" % (event['method'], str(e)))
AttributeError: 'NoneType' object has no attribute 'error'

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

It seems to work every time in 3.5, but in 2.7 i'm seeing errors like these.

from pychrome.

fate0 avatar fate0 commented on May 21, 2024

I still failed to reproduce this problem by using your gist, this time logger seems to be a NoneType object, I am pretty sure logger been initialized tab.py#L25, Could you reproduce the problem on other machines?

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

I'm running it on a fresh Ubuntu 16.04.2 LTS virtual box with Python 2.7.12 & 3.5.2.

I've noticed on 3.5, although it seems to be working, it's not performing the write in the EventHandler detached method. It seems to close while it's inside of that method. I've updated the gist with comments. Look at the detached function, and specifically line 150.

https://gist.github.com/matthewlilley/a5782b204a976484f8fe04443f509018

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

I was unsure if you needed to enable inspector, because it gets into the detached method and has the correct "reason" returned with it enabled and without. On 3.5 it actually gets into the detached method, but doesn't make it to the end of the function, and in 2.7 it never enters the function.

from pychrome.

fate0 avatar fate0 commented on May 21, 2024

when you call tab.stop(), It will stop handle all events, so you need to delete this line of code
https://gist.github.com/matthewlilley/a5782b204a976484f8fe04443f509018#file-gistfile1-txt-L117

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

I mistakenly thought I could use the Inspector.detached event to capture a timeout, but that seems wrong now as every page will fire it if tab.stop() isn't called there. It was okay in the situation though, because Page.frameStoppedLoading event doesn't get fired when a request has timed out.

All I want to do is capture a failed page load and write a log.

Also, that still doesn't solve: 'NoneType' object has no attribute 'Empty' on the Queue object in tab.py. It makes it worse :D

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

I've update the gist. https://pastebin.com/i6JneJ5b - I'm not worried about using inspector.

I'll see if I can see what's going on in 2.7 and causing Exceptions like this:

Exception in thread Thread-8 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/usr/lib/python2.7/threading.py", line 754, in run
File "/usr/local/lib/python2.7/dist-packages/pychrome/tab.py", line 151, in _handle_event_loop
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

Seems like the daemon isn't being shut down correctly, at least on 2.7: http://prntscr.com/gaux4f

from pychrome.

matthewlilley avatar matthewlilley commented on May 21, 2024

@fate0

I solved this by calling close_all_tabs at the end of the script, instead of closing them one by one. I just ran the same code with that change on 2.7, and no exceptions.

I should have been ensuring the offending tab was stopped at the end of the script. This isn't a bug.

from pychrome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.