This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author iritkatriel
Recipients iritkatriel, rgrewe
Date 2020-08-14.15:47:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1597420039.53.0.0669645178549.issue41550@roundup.psfhosted.org>
In-reply-to
Content
I've now reproduced it on osX, with string length of 65515. It takes a different code path than the windows version, and I was able to see more. 

This seems to be the sequence of events that leads to the hang:

import multiprocessing.reduction
import struct
import os
string_length = 65515
obj = "a"*string_length
obj = multiprocessing.reduction.ForkingPickler.dumps(obj)
m = memoryview(obj)
n = 65533
mm = m[0:n]
_, writer = os.pipe()
header = struct.pack("!i", n)
os.write(writer, header)
os.write(writer, mm)


I think what's happening is that the os.pipe that the queue is writing to has filled up, and then write blocks until any of it has been consumed.  This version of your script seems to confirm that:

import multiprocessing
import sys

q = multiprocessing.SimpleQueue()

string_length = eval(sys.argv[1])
print(string_length)
long_string = "a"*(string_length//2)
q.put(long_string)
q.get()                   <---- comment this out and it hangs again
q.put(long_string)

print("Never reach this line :-(")
History
Date User Action Args
2020-08-14 15:47:19iritkatrielsetrecipients: + iritkatriel, rgrewe
2020-08-14 15:47:19iritkatrielsetmessageid: <1597420039.53.0.0669645178549.issue41550@roundup.psfhosted.org>
2020-08-14 15:47:19iritkatriellinkissue41550 messages
2020-08-14 15:47:19iritkatrielcreate