python crash on windows but not on linux

H

hjebbers

In that case, you need to -- very carefully -- make sure you transcribe
exactly the message that you see on the screen.
--
Aahz ([email protected])           <*>        http://www.pythoncraft.com/

"At Resolver we've found it useful to short-circuit any doubt and just        
refer to comments in code as 'lies'. :)"

The message on the screen is (I typed it over):

**************************************************************************************
python.exe

python.exe has encountered a problem and needs to close.
We are sorry for the inconvenience.

If you were in the middle of something, the information you were
working on might be
lost

For more information about the error, click here.

<close-
button>
***************************************************************************************
the information about the error is a windows dump.

kind regards,
henk-jan
 
D

Dave Angel

hjebbers said:
The message on the screen is (I typed it over):

<snip>

You shouldn't ever have to retype the message. Just paste from the DOS
box (or "Command Prompt"). It's easy using QuickEdit mode.

You select a rectangle of the text by selecting with the mouse, then
using right-click to put it in the clipboard.

If that doesn't work, you haven't yet enabled QuickEdit mode. Use
right-click on the DOS box's title bar. Choose Properties. Select the
first tab, which is Options.

You should then see a selection box called "Quick Edit Mode". Turn it
on, and you won't have this problem again.

DaveA
 
H

hjebbers

hjebbers said:
On Feb 12, 3:41 am, (e-mail address removed) (Aahz) wrote:
You shouldn't ever have to retype the message.  Just paste from the DOS
box (or "Command Prompt").  It's easy using QuickEdit mode.

You select a rectangle of the text by selecting with the mouse, then
using right-click to put it in the clipboard.

If that doesn't work, you haven't yet enabled QuickEdit mode.  Use
right-click on the DOS box's title bar.  Choose Properties.  Select the
first tab, which is Options.

You should then see a selection box called "Quick Edit Mode".  Turn it
on, and you won't have this problem again.

DaveA

Hi Dave,

thanks.
but the message is not in the DOS box (or "Command Prompt").
I do run the program in a DOS box (or "Command Prompt"), but the error
is a windows dialog box.
I can not select in this dialog box.

kind regards,
henk-jan
 
S

Steve Holden

Dave said:
You shouldn't ever have to retype the message. Just paste from the DOS
box (or "Command Prompt"). It's easy using QuickEdit mode.

You select a rectangle of the text by selecting with the mouse, then
using right-click to put it in the clipboard.

If that doesn't work, you haven't yet enabled QuickEdit mode. Use
right-click on the DOS box's title bar. Choose Properties. Select the
first tab, which is Options.

You should then see a selection box called "Quick Edit Mode". Turn it
on, and you won't have this problem again.

DaveA
Dave:

I think you miss the point: this message is being displayed in a Windows
error message dialog box, not in the command window.

regards
Steve
 
S

Steve Holden

Dave said:
You shouldn't ever have to retype the message. Just paste from the DOS
box (or "Command Prompt"). It's easy using QuickEdit mode.

You select a rectangle of the text by selecting with the mouse, then
using right-click to put it in the clipboard.

If that doesn't work, you haven't yet enabled QuickEdit mode. Use
right-click on the DOS box's title bar. Choose Properties. Select the
first tab, which is Options.

You should then see a selection box called "Quick Edit Mode". Turn it
on, and you won't have this problem again.

DaveA
Dave:

I think you miss the point: this message is being displayed in a Windows
error message dialog box, not in the command window.

regards
Steve
 
P

Peter Otten

hjebbers said:
if it is in the platform-specific code should I make this into a
bugreport?

A this stage a bug report would be useless. The details you have provided so
far don't give anyone without physical access to your machine a chance to
reproduce the error.
(because the crash does not appear at the same place in my code (when
doing the same test-run) it will be quite hard to point down....)

Indeed. The culprit may be an extension written in C that is overwriting
memory still in use by other parts of your program.

Peter
 
D

Dave Angel

hjebbers said:
Hi Dave,

thanks.
but the message is not in the DOS box (or "Command Prompt").
I do run the program in a DOS box (or "Command Prompt"), but the error
is a windows dialog box.
I can not select in this dialog box.

kind regards,
henk-jan
Whoops! I agree those dialog boxes that don't support select/copy are
a pain. Sorry my response wasn't applicable.

DaveA
 
H

hjebbers

A this stage a bug report would be useless. The details you have provided so
far don't give anyone without physical access to your machine a chance to
reproduce the error.


Indeed. The culprit may be an extension written in C that is overwriting
memory still in use by other parts of your program.

Peter

No C extensions used. Definitely not.

As these crashes occur during stress tests, I go to the limits of the
memory available.
What strikes me is:
1. the crash on windows, but linux works OK (same test sets)
2. the linux box has 750Mb RAM, the windows box has 1.5Gb (twice as
much).

kind regards, Henk-jan
 
D

Dennis Lee Bieber

What strikes me is:
1. the crash on windows, but linux works OK (same test sets)
2. the linux box has 750Mb RAM, the windows box has 1.5Gb (twice as
much).
Which on its own does not mean much.

Windows in a normal installation only grants 2GB address space to
user code, reserving the other 2GB space for the OS shared libraries. If
your program attempts to allocate over that, it will fail. That the
Windows box has twice the physical memory only means it doesn't resort
to page swapping as soon.

There is a boot parameter switch that toggles Windows into a 3GB
user/1GB OS mode -- it is mainly meant for server machines where there
won't be many disjoint OS libraries loaded, but the server applications
need lots of data space.

What split does the Linux OS use? If it give 3GB to user space,
while you'd start to page swap much soon, you'd also have 50% more
virtual memory that can be allocated than under Windows.
 
P

Peter Otten

hjebbers said:
No C extensions used. Definitely not.

As these crashes occur during stress tests, I go to the limits of the
memory available.
What strikes me is:
1. the crash on windows, but linux works OK (same test sets)
2. the linux box has 750Mb RAM, the windows box has 1.5Gb (twice as
much).

Random thoughts:

If there were not enough memory Python should give a MemoryError rather than
segfault.

Do both systems use the same memory layout (i. e. 32 or 64bit OS, 16 or 32
bit unicode)?

Try an alpha of Python 2.7. If you're lucky "your" bug was found 'n' fixed
independently.

Peter
 
H

hjebbers

hjebbers wrote in (e-mail address removed) in comp.lang.python:


This may help:

#http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx

SEM_FAILCRITICALERRORS = 1
SEM_NOALIGNMENTFAULTEXCEPT = 4
SEM_NOGPFAULTERRORBOX = 4
SEM_NOOPENFILEERRORBOX = 8

import ctypes
from ctypes.wintypes import UINT

SetErrorMode = ctypes.windll.kernel32.SetErrorMode
SetErrorMode.restype = UINT
SetErrorMode.argtypes = ( UINT,)

Then putting:

SetErrorMode( SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX )

at the start of you programme, should stop the "Critical Error" dialog
box you are seeing and you may get a chance to see a traceback.

Rob.

Hi Rob,

thanks.
I tried this, but did not work for me.

henk-jan
 
H

hjebbers

Random thoughts:

If there were not enough memory Python should give a MemoryError rather than
segfault.

Do both systems use the same memory layout (i. e. 32 or 64bit OS, 16 or 32
bit unicode)?
bot use 32bits;
but the windows box uses 16 bits unicode, on linux 32bits unicode is
used.
the memory used by my program is for the larger part unicode strings.
.....well, but that makes the better performance of linux even
stranger...
Try an alpha of Python 2.7. If you're lucky "your" bug was found 'n' fixed
independently.
well...that's what I thought for version 2.6 ;-)
(I run into this crash a longer time ago)
but seriously, I'll try this.

kind regards,
henk-jan
 
H

hjebbers

        Which on its own does not mean much.

        Windows in a normal installation only grants 2GB address space to
user code, reserving the other 2GB space for the OS shared libraries. If
your program attempts to allocate over that, it will fail. That the
Windows box has twice the physical memory only means it doesn't resort
to page swapping as soon.

        There is a boot parameter switch that toggles Windows into a 3GB
user/1GB OS mode --

hey, that would be great!! on my 1,5G mahcine ;-)

it is mainly meant for server machines where there
won't be many disjoint OS libraries loaded, but the server applications
need lots of data space.

        What split does the Linux OS use? If it give 3GB to user space,
while you'd start to page swap much soon, you'd also have 50% more
virtual memory that can be allocated than under Windows.

I will check this.....any advice on how to check this?

henk-jan
 
H

hjebbers

to all,

thanks for the pointers so far.
if you feel the need to reproduce the crash, it's not that hard,
(downloading and installing my edi translator, install configuration
(button-click), and run.
I have a modified version (replace some *.py files) that eliminate a
lot of stuff (simpler setup, no database used, no external C-modules).
contact me for recipe and files

about me being reluctant to 'show the code':
- the crash that happens during stress tests.
- the crash occurs not always, and at different points.
- the code does runs OK on linux (which does not mean there's no bugt
in it ;-)

kind regards,
henk-jan
 
D

Diez B. Roggisch

Am 13.02.10 11:50, schrieb hjebbers:
hey, that would be great!! on my 1,5G mahcine ;-)

You don't get it - it's about the virtual memory address space
available. This has nothing to do with physical memory. Obviously if the
latter runs out, the swapping will make the machine painfully slow. But
that's another issue.


Diez
 
H

hjebbers

Am 13.02.10 11:50, schrieb hjebbers:





You don't get it - it's about the virtual memory address space
available. This has nothing to do with physical memory. Obviously if the
latter runs out, the swapping will make the machine painfully slow. But
that's another issue.

Diez

Diez,
you are right; I misunderstood.
henk-jan
 
H

hjebbers

I enlarged the windows page file from 750Kb to 1.5Gb .
The crash still happens.
btw, the crash does not happen at a peak memory usage.
According to windows task manager, at the moment of crash mem usage of
my program is 669kb, peak memory usage is 1.136kb

henk-jan
 
A

Alf P. Steinbach

* hjebbers:
I enlarged the windows page file from 750Kb to 1.5Gb .
The crash still happens.
btw, the crash does not happen at a peak memory usage.
According to windows task manager, at the moment of crash mem usage of
my program is 669kb, peak memory usage is 1.136kb

henk-jan

Probably you meant to write "M", not "k" or "K"?

I've never managed to make much sense of the displays in Windows' Task Manager,
if that's what you're using, but I think the mem usage it's displaying by
default is the process' working set, or something very similar to that measure.

You can display additional columns in Task Manager, and one useful one is how
much virtual memory is allocated,.

And perhaps then (if that's not what you're looking it already) it'll be closer
to 2 GiB?



Cheers & hth.,

- Alf
 
H

hjebbers

        Which on its own does not mean much.

        Windows in a normal installation only grants 2GB address space to
user code, reserving the other 2GB space for the OS shared libraries. If
your program attempts to allocate over that, it will fail. That the
Windows box has twice the physical memory only means it doesn't resort
to page swapping as soon.

        There is a boot parameter switch that toggles Windows into a 3GB
user/1GB OS mode -- it is mainly meant for server machines where there
won't be many disjoint OS libraries loaded, but the server applications
need lots of data space.

        What split does the Linux OS use? If it give 3GB to user space,
while you'd start to page swap much soon, you'd also have 50% more
virtual memory that can be allocated than under Windows.

Hi Wulfraed,
I tried this (the 3GB switch).
But python still crashes.

kind regards,
henk-jan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top