Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
cca8c53d
Kaydet (Commit)
cca8c53d
authored
Tem 01, 2013
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17097: Make multiprocessing ignore EINTR.
üst
80878793
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
4 deletions
+86
-4
connection.py
Lib/multiprocessing/connection.py
+15
-3
test_multiprocessing.py
Lib/test/test_multiprocessing.py
+69
-1
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/multiprocessing/connection.py
Dosyayı görüntüle @
cca8c53d
...
...
@@ -366,7 +366,10 @@ class Connection(_ConnectionBase):
def
_send
(
self
,
buf
,
write
=
_write
):
remaining
=
len
(
buf
)
while
True
:
n
=
write
(
self
.
_handle
,
buf
)
try
:
n
=
write
(
self
.
_handle
,
buf
)
except
InterruptedError
:
continue
remaining
-=
n
if
remaining
==
0
:
break
...
...
@@ -377,7 +380,10 @@ class Connection(_ConnectionBase):
handle
=
self
.
_handle
remaining
=
size
while
remaining
>
0
:
chunk
=
read
(
handle
,
remaining
)
try
:
chunk
=
read
(
handle
,
remaining
)
except
InterruptedError
:
continue
n
=
len
(
chunk
)
if
n
==
0
:
if
remaining
==
size
:
...
...
@@ -581,7 +587,13 @@ class SocketListener(object):
self
.
_unlink
=
None
def
accept
(
self
):
s
,
self
.
_last_accepted
=
self
.
_socket
.
accept
()
while
True
:
try
:
s
,
self
.
_last_accepted
=
self
.
_socket
.
accept
()
except
InterruptedError
:
pass
else
:
break
s
.
setblocking
(
True
)
return
Connection
(
s
.
detach
())
...
...
Lib/test/test_multiprocessing.py
Dosyayı görüntüle @
cca8c53d
...
...
@@ -3460,6 +3460,74 @@ class TestForkAwareThreadLock(unittest.TestCase):
p
.
join
()
self
.
assertLessEqual
(
new_size
,
old_size
)
#
# Issue #17097: EINTR should be ignored by recv(), send(), accept() etc
#
class
TestIgnoreEINTR
(
unittest
.
TestCase
):
@classmethod
def
_test_ignore
(
cls
,
conn
):
def
handler
(
signum
,
frame
):
pass
signal
.
signal
(
signal
.
SIGUSR1
,
handler
)
conn
.
send
(
'ready'
)
x
=
conn
.
recv
()
conn
.
send
(
x
)
conn
.
send_bytes
(
b
'x'
*
(
1024
*
1024
))
# sending 1 MB should block
@unittest.skipUnless
(
hasattr
(
signal
,
'SIGUSR1'
),
'requires SIGUSR1'
)
def
test_ignore
(
self
):
conn
,
child_conn
=
multiprocessing
.
Pipe
()
try
:
p
=
multiprocessing
.
Process
(
target
=
self
.
_test_ignore
,
args
=
(
child_conn
,))
p
.
daemon
=
True
p
.
start
()
child_conn
.
close
()
self
.
assertEqual
(
conn
.
recv
(),
'ready'
)
time
.
sleep
(
0.1
)
os
.
kill
(
p
.
pid
,
signal
.
SIGUSR1
)
time
.
sleep
(
0.1
)
conn
.
send
(
1234
)
self
.
assertEqual
(
conn
.
recv
(),
1234
)
time
.
sleep
(
0.1
)
os
.
kill
(
p
.
pid
,
signal
.
SIGUSR1
)
self
.
assertEqual
(
conn
.
recv_bytes
(),
b
'x'
*
(
1024
*
1024
))
time
.
sleep
(
0.1
)
p
.
join
()
finally
:
conn
.
close
()
@classmethod
def
_test_ignore_listener
(
cls
,
conn
):
def
handler
(
signum
,
frame
):
pass
signal
.
signal
(
signal
.
SIGUSR1
,
handler
)
l
=
multiprocessing
.
connection
.
Listener
()
conn
.
send
(
l
.
address
)
a
=
l
.
accept
()
a
.
send
(
'welcome'
)
@unittest.skipUnless
(
hasattr
(
signal
,
'SIGUSR1'
),
'requires SIGUSR1'
)
def
test_ignore_listener
(
self
):
conn
,
child_conn
=
multiprocessing
.
Pipe
()
try
:
p
=
multiprocessing
.
Process
(
target
=
self
.
_test_ignore_listener
,
args
=
(
child_conn
,))
p
.
daemon
=
True
p
.
start
()
child_conn
.
close
()
address
=
conn
.
recv
()
time
.
sleep
(
0.1
)
os
.
kill
(
p
.
pid
,
signal
.
SIGUSR1
)
time
.
sleep
(
0.1
)
client
=
multiprocessing
.
connection
.
Client
(
address
)
self
.
assertEqual
(
client
.
recv
(),
'welcome'
)
p
.
join
()
finally
:
conn
.
close
()
#
#
#
...
...
@@ -3467,7 +3535,7 @@ class TestForkAwareThreadLock(unittest.TestCase):
testcases_other
=
[
OtherTest
,
TestInvalidHandle
,
TestInitializers
,
TestStdinBadfiledescriptor
,
TestWait
,
TestInvalidFamily
,
TestFlags
,
TestTimeouts
,
TestNoForkBomb
,
TestForkAwareThreadLock
]
TestForkAwareThreadLock
,
TestIgnoreEINTR
]
#
#
...
...
Misc/NEWS
Dosyayı görüntüle @
cca8c53d
...
...
@@ -38,6 +38,8 @@ Core and Builtins
Library
-------
- Issue #17097: Make multiprocessing ignore EINTR.
- Issue #18339: Negative ints keys in unpickler.memo dict no longer cause a
segfault inside the _pickle C extension.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment