rdmenezes / cefpython

Automatically exported from code.google.com/p/cefpython
1 stars 0 forks source link

Download Handler crashes on links with target="_blank" attribute #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.download a small file.
2.OnData if i set return False ,but loop second time .
3.the application crash,

    def OnData(self, data):
        if data is None or len(data)==0:
            return False
        self.alreadyDownloaded += len(data)
        if self.alreadyDownloaded>=self.contentLength:
            return False
        self.fp.write(data)
        return False

[0801/144930:FATAL:url_request_context.cc(116)] Check failed: false. Leaked 1 
URLRequest(s). First URL: ******.
[0801/144933:ERROR_REPORT:cef_context.cc(570)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI).
[0801/144933:ERROR_REPORT:browser_impl.h(182)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI).
[0801/144933:ERROR_REPORT:browser_impl.h(186)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI).

Original issue reported on code.google.com by cjjer....@gmail.com on 1 Aug 2013 at 6:54

GoogleCodeExporter commented 9 years ago
Have you tried downloading this file using the wxpython.py example? 
It has download handler implemented and it worked fine for me. Does this
problem also occur in the wxpython.py example? Or is it only in your
script?

What file are you trying to download? Is this problem reproducible with
any file size / type?

Original comment by czarek.t...@gmail.com on 1 Aug 2013 at 7:03

GoogleCodeExporter commented 9 years ago
yes,it alway execute two timer if return False

Original comment by cjjer....@gmail.com on 1 Aug 2013 at 7:31

GoogleCodeExporter commented 9 years ago
wxpython.py example work very well but gtk....my god.
maybe it is not because of cefpyhon. 
thanks czarek.

Original comment by cjjer....@gmail.com on 1 Aug 2013 at 8:40

GoogleCodeExporter commented 9 years ago
The failed checks about wrong thread are disturbing:

    [0801/144933:ERROR_REPORT:cef_context.cc(570)] Check failed: CefThread::CurrentlyOn(CefThread::UI).
    [0801/144933:ERROR_REPORT:browser_impl.h(182)] Check failed: CefThread::CurrentlyOn(CefThread::UI).
    [0801/144933:ERROR_REPORT:browser_impl.h(186)] Check failed: CefThread::CurrentlyOn(CefThread::UI).

Make sure you're calling functions on correct threads. In the wiki documentation
there are notes informing you on which thread the callback is called. When
it is called on the IO or FILE thread, you should be careful if you make calls
to GUI functions that might require running on GUI threads.

Original comment by czarek.t...@gmail.com on 1 Aug 2013 at 8:46

GoogleCodeExporter commented 9 years ago
I test again,it strange,the wxpyhon.py example not work.
if i download small file,when i close the window,crash:
debug.log:

[0803/091536:ERROR_REPORT:cef_context.cc(570)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/091536:ERROR_REPORT:browser_impl.h(182)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/091536:ERROR_REPORT:browser_impl.h(186)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/091536:ERROR_REPORT:browser_appcache_system.cc(185)] Check failed: false. 

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 1:17

GoogleCodeExporter commented 9 years ago
in fact ,application  alway crash when i close the window with an error dialog 
box and flash 1 sencond and disappe

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 1:25

GoogleCodeExporter commented 9 years ago
Can you write all the steps that reproduce the crash in the wxpython.py example?

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 5:24

GoogleCodeExporter commented 9 years ago
yes:

1:open the wxpython.py example.
2:download a file. and wait finished.
3:close the [wxpython.py]
4:crash,flash 1 seconds ,the error box disapper. 
5:the log is before a send.

you can connection me with qq 369987789.:D

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 6:33

GoogleCodeExporter commented 9 years ago
Cjjer, what link are you trying to download?

I'm on Linux right now, I think this will be problematic to run QQ, as there
is no stable release for Linux. For now this is really not necessary. I think
I will be able to reproduce the problem with detailed info. Provide me with
the link. Also please explain what the point 5 means "the log is before a send."

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 6:47

GoogleCodeExporter commented 9 years ago
You could also add print() statements over the DownloadHandler code (and other
functions if necessary), this would tell us at which moment the errors in the
console are thrown out. It is best to paste all the messages from the console,
cefpython debug messages would also be useful.

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 6:51

GoogleCodeExporter commented 9 years ago
for liunx  http://im.qq.com/qq/linux/download.shtml

the log is

[0803/091536:ERROR_REPORT:cef_context.cc(570)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/091536:ERROR_REPORT:browser_impl.h(182)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/091536:ERROR_REPORT:browser_impl.h(186)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/091536:ERROR_REPORT:browser_appcache_system.cc(185)] Check failed: false. 

i post yesterday.:D

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 6:52

GoogleCodeExporter commented 9 years ago
NOW IT WORK....

without nothing change,very strange

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 6:57

GoogleCodeExporter commented 9 years ago
hah,i get the error again:

Download is already in progress
[0803/145952:FATAL:url_request_context.cc(116)] Check failed: false. Leaked 1 
URLRequest(s). First URL: http://cefpython
.googlecode.com/files/ubuntu-wallpapers2.zip.

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 7:00

GoogleCodeExporter commented 9 years ago
[0803/092939:ERROR_REPORT:cef_context.cc(570)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/092939:ERROR_REPORT:browser_impl.h(182)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/092939:ERROR_REPORT:browser_impl.h(186)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/092939:ERROR_REPORT:browser_appcache_system.cc(185)] Check failed: false. 
[0803/145952:FATAL:url_request_context.cc(116)] Check failed: false. Leaked 1 
URLRequest(s). First URL: 
http://cefpython.googlecode.com/files/ubuntu-wallpapers2.zip.

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 7:01

GoogleCodeExporter commented 9 years ago
screen:

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 7:04

Attachments:

GoogleCodeExporter commented 9 years ago
Cjjer, Please paste all log messages from the console including cefpython
debug messages (starting from "cefpython.Initialize()" message). To see
these messages you have to uncomment line 513 in the wxpython.py script:

    cefpython.g_debug = True

https://code.google.com/p/cefpython/source/browse/cefpython/cef1/windows/binarie
s/wxpython.py#513

Have you made *any* modifications to the wxpython.py script? I know for sure
that if you try to download two files at the same time with the current
download handler implementation in the wxpython script, then this will result
in errors. I see in your log messages the "Download is already in progress"
message and that makes me think whether you've modified the source to be able
to download more files at once. Is it 100% the original wxpython script?

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 7:13

GoogleCodeExporter commented 9 years ago
What OS are you running? And what cefpython version?

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 7:15

GoogleCodeExporter commented 9 years ago
In your first post I see that you return False at the end of OnData() callback.
Why are you doing this? This cancels the download. See the documentation:

    A portion of the file contents have been received. This method will be called 
    multiple times until the download is complete. Return |True| to continue receiving 
    data and |False| to cancel.

This condition also seems wrong:

    if data is None or len(data)==0:
        return False

Why are you making this check?

This check is also wrong:

    if self.alreadyDownloaded>=self.contentLength:
        return False

If the content-length wasn't provided then self.contentLength will be -1,
thus this condition will always be true, thus you will always return False
in OnData().

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 7:22

GoogleCodeExporter commented 9 years ago
NO.SURE. no modified .
100% the original wxpython script.

Version: cefpython1-27.0-win32-py27.exe
OS:windows 2003.

yes, you are right.

maybe you are right.i test again,but the error not apper.let't me test again 
and again ...

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 7:58

GoogleCodeExporter commented 9 years ago
hha,you are right.thank  you.

this is the OLD code i test before,now i use wxpython.py code.

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 8:00

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
YES!!i get the error and i know WHY!

<a href="XXXXX" target="_blank">XXXXX</a>

because i use  [target="_blank"] in html file !

should this cause twice  ?

console log:

DownloadHandler() created
mimeType: application/octet-stream
filename: 6c65_chrome1.3.crx
contentLength: 22730
Download progress: .[0803/161045:FATAL:url_request_context.cc(116)] Check 
failed: false. Leaked 1 URLRequest(s). First U
RL: http://f.test.com/toolbar/chrome1.3.crx.
.[0803/161046:ERROR_REPORT:cef_context.cc(570)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI).
[0803/161046:ERROR_REPORT:browser_impl.h(182)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI).
[0803/161046:ERROR_REPORT:browser_impl.h(186)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI).

Debug file:
[0803/161045:FATAL:url_request_context.cc(116)] Check failed: false. Leaked 1 
URLRequest(s). First URL: http://f.test.com/toolbar/chrome1.3.crx.
[0803/161046:ERROR_REPORT:cef_context.cc(570)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/161046:ERROR_REPORT:browser_impl.h(182)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 
[0803/161046:ERROR_REPORT:browser_impl.h(186)] Check failed: 
CefThread::CurrentlyOn(CefThread::UI). 

ANYWAY:

when i just close the console CMD window ,the application crash,it is normal or 
not.

thank you 

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 8:15

GoogleCodeExporter commented 9 years ago
The crash when closing DOS box is normal, see Issue 66. It happens only on
developer machines so don't worry. Close the app window before closing the
DOS window and it will be fine.

I have reproduced the problem on Linux. When I add "target=_blank" then
a popup window opens and the app crashes during the download. I have
added a print() in GetDownloadHandler() and it seems that there is only
one download happening. I will try to debug this.

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 8:29

GoogleCodeExporter commented 9 years ago
great.wait new version.

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 8:37

GoogleCodeExporter commented 9 years ago
Please can you try running the cefclient.exe sample browser that is provided
with the cefpython binaries? Try to download a file using a link with the
target=_blank attribute. Does the error also occur?

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 9:04

GoogleCodeExporter commented 9 years ago
yes,also crash.

Original comment by cjjer....@gmail.com on 3 Aug 2013 at 10:11

Attachments:

GoogleCodeExporter commented 9 years ago
Reported problem on the CEF Forum and awaiting Marshall's response:
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10910

Original comment by czarek.t...@gmail.com on 3 Aug 2013 at 11:21

GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 4 Aug 2013 at 7:56

GoogleCodeExporter commented 9 years ago
Submitted `issue 1045` in the CEF Issue Tracker:
https://code.google.com/p/chromiumembedded/issues/detail?id=1045

Original comment by czarek.t...@gmail.com on 7 Aug 2013 at 7:20

GoogleCodeExporter commented 9 years ago
This won't be fixed in CEF 1, see:
https://code.google.com/p/chromiumembedded/issues/detail?id=1045#c2

Original comment by czarek.t...@gmail.com on 11 Oct 2013 at 2:59

GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 11 Oct 2013 at 2:59