Changes between Initial Version and Version 1 of Ticket #715, comment 241


Ignore:
Timestamp:
09/05/12 22:34:49 (9 years ago)
Author:
nbruin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #715, comment 241

    initial v1  
    11Replying to [comment:240 SimonKing]:
    22>  * Test the file - there is a segfault, but it doesn't give any clue of what is happening.
    3 I'm pretty sure that's because sage-doctest redirects the output somewhere. I'm sure the SIGSEGV causes the usual traceback upon sage crashing. So I'd start breaking into the sage-doctest script and change little things there, hoping to not upset the subtle conditions required to trigger the fault.
     3I'm pretty sure that's because sage-doctest redirects the output somewhere. I'm
     4sure the SIGSEGV causes the usual traceback upon sage crashing. So I'd start
     5breaking into the sage-doctest script and change little things there, hoping to
     6not upset the subtle conditions required to trigger the fault. Indeed
    47
    5 Of course, that would only show you where the SEGV occurs, which may or may not be related to the real culprit.
     8'''local/bin/sage-doctest''':801
     9{{{#!python
     10            if verbose or gdb or memcheck or massif or cachegrind:
     11                import subprocess
     12                proc = subprocess.Popen(cmd, shell=True)
     13                while time.time()-tm <= TIMEOUT and proc.poll() == None:
     14                    time.sleep(0.1)
     15                if time.time()-tm >=TIMEOUT:
     16                    os.kill(proc.pid, 9)
     17                    print "*** *** Error: TIMED OUT! PROCESS KILLED! *** ***"
     18                e = proc.poll()
     19            else:
     20                outf = tempfile.NamedTemporaryFile()
     21                import subprocess
     22                proc = subprocess.Popen(cmd, shell=True, \
     23                        stdout=outf.file.fileno(), stderr = outf.file.fileno())
     24                while time.time()-tm <= TIMEOUT and proc.poll() == None:
     25                    time.sleep(0.1)
     26                if time.time()-tm >=TIMEOUT:
     27                    os.kill(proc.pid, 9)
     28                    print "*** *** Error: TIMED OUT! PROCESS KILLED! *** ***"
     29                outf.file.seek(0)
     30                out = outf.read()
     31                e = proc.poll()
     32}}}
     33The worrying bit is that the way I read the code, `cmd` is not affected by
     34`--verbose`. So then the SEGV would depend on whether `stdout` and `stderr` are
     35redirected. However, you could add a `print out`. Perhaps do a `outf.sync()` too
     36(would that even help?), although I guess by then the child process has died already and would have
     37flushed its buffers to the file.
     38
     39Of course, this all only might help you to figure out where the SEGV occurs,
     40which may or may not be related to the real culprit.