#17924: Failure in doctest framework when running in docker
-------------------------------------+-------------------------------------
Reporter: Vincent.Neri | Owner:
Type: defect | Status: needs_info
Priority: major | Milestone: sage-6.6
Component: doctest framework | Resolution:
Keywords: docker | Merged in:
Authors: Vincent Neri | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/Vincent.Neri/failure_in_doctest_framework_when_running_in_docker|
add3e53a81dafd966b07727d87c3d441e1e2468f
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by vbraun):
Minimal testcase (run with `sage -python docker-semaphore.py`):
{{{
#!python
import multiprocessing, os, sys, time, signal, pexpect
## Not importing Sage makes the bug go away
import sage.all
class Subprocess(multiprocessing.Process):
def run(self):
result_queue = multiprocessing.Queue(1)
try:
print('run-pre: {0}'.format(result_queue._sem))
p = pexpect.spawn('QuadraticSieve')
p.sendline('100000000000000000050700000000000000004563\n\n\n')
p.closed = True # avoid surprises from p.__del__
print('run-post 1: {0}'.format(result_queue._sem))
os.kill(p.pid, signal.SIGHUP)
print('run-post 2: {0}'.format(result_queue._sem))
time.sleep(0.1)
print('run-post 3: {0}'.format(result_queue._sem))
except SystemExit as err:
# Not catching SystemExit makes the bug go away
print(err)
# Checking empty makes the bug go away
# print(result_queue.empty())
# This is the bug, value should equal to one
v = result_queue._sem.get_value()
if v == 0:
print('got the wrong value for the semaphore')
# Raises Full
result_queue.put(123, False)
if __name__ == '__main__':
w = Subprocess()
w.start()
}}}
Output inside the docker container is
{{{
run-pre: <BoundedSemaphore(value=1, count=0, maxvalue=1)>
run-post 1: <BoundedSemaphore(value=1, count=0, maxvalue=1)>
run-post 2: <BoundedSemaphore(value=1, count=0, maxvalue=1)>
run-post 3: <BoundedSemaphore(value=0, count=0, maxvalue=1)>
got the wrong value for the semaphore
}}}
The value of the semaphore switches to zero a short while after the
process is killed, but I don't understand why. Must be something that we
drag in with importing sage...
--
Ticket URL: <http://trac.sagemath.org/ticket/17924#comment:28>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.