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

Application error in python.exe when closing main browser window #2

Closed
GoogleCodeExporter opened this issue Aug 28, 2015 · 28 comments
Closed

Comments

@GoogleCodeExporter
Copy link

It's a random error happening on application exit. I am able to reproduce it 
right now by doing a lot of clicks in the window, then closing it. The exact 
error message below:

python.exe - Application Error
---------------------------
The instruction at "0x7ca712b7" references memory at "0x00c5fe28". The memory 
could not be "read".
Click on OK to terminate the program
---------------------------

It sometimes references to "0x00c5feb0".

I tried running WinDbg but failed even to start the script with it, getting 
some kernel errors.

I tried running Spy++ and I see something strange happening in the top window 
(top-right of the screen), a WM_CLOSE message is called after WM_NCDESTROY. 
That window is created using pywin32 extension. There are 2 other inner windows 
created by CEF, but they seem to have proper messages,  there are no more 
messages processed after WM_NCDESTROY which is a correct behavior. Attaching 
!Spy++ screenshot.

Original issue reported on code.google.com by czarek.t...@gmail.com on 8 Jul 2012 at 8:14

Attachments:

@GoogleCodeExporter
Copy link
Author

To the left of message id ex. WM_CLOSE there is a letter, one of "S", "P", "R", 
their meaning are:

S - the message sent using SendMessage()
P - using PostMessage()
R - denotes return value for SendMessage()

Maybe we should PostMessage to destroy the main window so that we can return 
immediately from WM_CLOSE and the order in these messages is correct.

Original comment by czarek.t...@gmail.com on 8 Jul 2012 at 8:41

  • Added labels: OpSys-Windows

@GoogleCodeExporter
Copy link
Author

Success. In CloseApplication() [cefadvanced.py and cefsimple.py] I've replaced:

> cefwindow.DestroyWindow(windowID)
with:
> win32api.PostMessage(windowID, win32con.WM_DESTROY, 0, 0)

And now order of messages in Spy++ is correct, "S WM_CLOSE", "R WM_CLOSE", "R 
WM_SYSCOMMAND" and the last "P WM_DESTROY".

In WM_CLOSE and WM_DESTROY procedures "return 0" statement can be omitted.

If I put "return win32gui.DefWindowProc()" after PostMessage() then the order 
of messages in Spy++ is wrong again, so don't do it.

I've been clicking and closing windows for a few minutes and it seems that 
everything works fine now. I will be testing it for the next few days, if there 
are no errors on exit then I will close this issue.

Original comment by czarek.t...@gmail.com on 8 Jul 2012 at 9:12

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Original comment by czarek.t...@gmail.com on 12 Jul 2012 at 10:39

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

This issue is still not properly fixed, errors of "memory cannot be read" when 
closing browser are still appearing on windows 2003.

Original comment by czarek.t...@gmail.com on 21 Aug 2012 at 12:20

  • Changed state: Accepted
  • Added labels: Priority-Critical
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

Issue in CEF has been reported:
http://code.google.com/p/chromiumembedded/issues/detail?id=700

Original comment by czarek.t...@gmail.com on 22 Aug 2012 at 6:30

@GoogleCodeExporter
Copy link
Author

This issue still persists in XP.

Original comment by alex.na...@gmail.com on 24 Aug 2012 at 4:16

@GoogleCodeExporter
Copy link
Author

In issue 700 on CEF:
http://code.google.com/p/chromiumembedded/issues/detail?id=700

Marshall has provided a solution. But to test it I will have to compile 
Chromium sources + CEF sources and build my own binaries, it can take time as 
it's probably not an easy task.

Original comment by czarek.t...@gmail.com on 24 Aug 2012 at 5:03

@GoogleCodeExporter
Copy link
Author

@alex.nanou:

In the meantime there is a solution, it's not perfect as CEF won't do cleanup 
after itself (scoped_dir/ in temp/) but it should get rid of error.

In QuitApplication() replace "win32gui.PostQuitMessage(0)" with this line:

    os.kill(os.getpid(), 9)

(one might also try sys.exit(0) or os._exit(0) - which are less drastic)

Original comment by czarek.t...@gmail.com on 24 Aug 2012 at 5:21

@GoogleCodeExporter
Copy link
Author

Update to temporary solution.

In QuitApplication() replace "win32gui.PostQuitMessage(0)" with this lines:

    cefpython.Shutdown()
    os.kill(os.getpid(), 9)

Original comment by czarek.t...@gmail.com on 24 Aug 2012 at 6:34

@GoogleCodeExporter
Copy link
Author

It would be be even better to put os.kill after the loop and shutdown, without 
modifying QuitApplication(), but I'm not sure whether it would fix the error, 
but worth checking. In CefAdvanced() add os.kill after MessageLoop() and 
Shutdown():

    cefpython.MessageLoop()
    cefpython.Shutdown()
    os.kill(os.getpid(), 9)

Alex can you confirm that this fixes the error?

Original comment by czarek.t...@gmail.com on 24 Aug 2012 at 6:44

@GoogleCodeExporter
Copy link
Author

At this point it's not critical, for me at least, the software I'm working on 
is not yet public and will not be out for several weeks... so I'm not digging 
in this particular issue yet.

BTW, neither workaround seems to work.

Original comment by alex.na...@gmail.com on 25 Aug 2012 at 9:13

@GoogleCodeExporter
Copy link
Author

I have a report from other user that os.kill() called after shutdown fixes the 
error. Please describe your error in more details as this seems like some other 
bug. Try putting os.kill in one of 3 places: in CloseApplication(), in 
QuitApplication(), after Shutdown() - one of them must fix the problem.

Original comment by czarek.t...@gmail.com on 25 Aug 2012 at 9:24

@GoogleCodeExporter
Copy link
Author

Are you using latest 0.35 version?

Original comment by czarek.t...@gmail.com on 25 Aug 2012 at 10:19

@GoogleCodeExporter
Copy link
Author

version 0.35, as before.

kill after Shutdown works.

Original comment by alex.na...@gmail.com on 26 Aug 2012 at 5:32

@GoogleCodeExporter
Copy link
Author

Putting os.kill after Shutdown() is the best place for it.
Use this solution until this issue is fixed.

Original comment by czarek.t...@gmail.com on 26 Aug 2012 at 5:59

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

I am unable to compile Chromium on WinXP, from what I read building chrome on 
XP is not supported anymore, command line arguments passed to compiler are too 
long and builds fail. I am going to need Win7 and a new hdd to build it.

Original comment by czarek.t...@gmail.com on 1 Sep 2012 at 7:39

@GoogleCodeExporter
Copy link
Author

I've successfully compiled Chromium, branch 1025 revision 607.
I've created 2 zip binaries to test.

1. Issue 2 test 1:

First we need to test whether to bug still persits, so use "test 1" to confirm 
the bug, app should crash when closing window while running this test.

http://code.google.com/p/cefpython/downloads/detail?name=issue2_test1_0.38_py27.
zip&can=2&q=#makechanges


2. Issue 2 test 2:

This binaries have the Marshall's patch applied, this should fix the crash when 
closing app.

http://code.google.com/p/cefpython/downloads/detail?name=issue2_test2_0.38_py27.
zip&can=2&q=#makechanges

Alex, let me know whether this fixes the problem.

Original comment by czarek.t...@gmail.com on 3 Sep 2012 at 9:45

@GoogleCodeExporter
Copy link
Author

Have a report from Cjjer that test2 still didn't fix the error. Will report 
that to Marshall, we will have to wait for some other fix.

Original comment by czarek.t...@gmail.com on 3 Sep 2012 at 9:56

@GoogleCodeExporter
Copy link
Author

i am cjjer.


windows2003 sp2,all test has the error.

Original comment by cjjer....@gmail.com on 3 Sep 2012 at 9:57

Attachments:

@GoogleCodeExporter
Copy link
Author

With big help of Cjjer, after many hours of testing we have this error fixed, 
I've made some minor modifications to the fix so it still needs some testing, 
here is the final test:

Test 6 should resolve this issue:
http://code.google.com/p/cefpython/downloads/detail?name=issue2_test6_0.38_py27.
zip

Original comment by czarek.t...@gmail.com on 3 Sep 2012 at 3:19

@GoogleCodeExporter
Copy link
Author

This issue is related to our problem:
"CEF1: Eliminate use of scoped directories"
http://code.google.com/p/chromiumembedded/issues/detail?id=670

Original comment by czarek.t...@gmail.com on 3 Sep 2012 at 9:46

@GoogleCodeExporter
Copy link
Author

Cjjer confirmed that test 6 fixes the error. This fix will make it into next 
release.

Original comment by czarek.t...@gmail.com on 4 Sep 2012 at 6:44

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Version 0.38 released.

Original comment by czarek.t...@gmail.com on 4 Sep 2012 at 9:18

@GoogleCodeExporter
Copy link
Author

This bug has been fixed in CEF sources in revision `827`:
http://code.google.com/p/chromiumembedded/source/detail?r=827

Original comment by czarek.t...@gmail.com on 21 Nov 2012 at 6:02

@GoogleCodeExporter
Copy link
Author

Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/cefpython/issues/2

Original comment by czarek.t...@gmail.com on 24 Aug 2015 at 6:23

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

1 participant