Memory errors when not using callback in Python producer
The following MWE crashes with different errors each time it is run:
import asapo_producer
source = "localhost:8400"
path = "auto"
beamtime = "asapo_test"
data_source = "eiger"
has_filesystem = False
token = ("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjMWY2OG0ydWlkZDE3dWxmaDN1ZyIsInN1YiI6ImJ0X2FzYXBvX3Rlc3QiLCJFeHRyYUNsYWltcyI6eyJBY2Nlc3NUeXBlcyI6WyJyZWFkIl19fQ.zo7ZDfY2sf4o9RYuXpxNR9kHLG594xr-SE5yLoyDC2Q")
stream_out = "producer_test"
nthreads = 1
producer = asapo_producer.create_producer(source, "processed", beamtime, "auto", stream_out, token, nthreads, 30000)
for i in range(10):
producer.send(i+1, f"processed/foo-{i}.txt", b"foo", stream="foo")
producer.wait_requests_finished(40000)
Example output:
{"time":"2023-06-15 18:42:24.231697050","source":"producer_api","level":"warning","message":"receiver list empty, put back to the queue, request opcode: 2, id: 1"}
munmap_chunk(): invalid pointer
Aborted (core dumped)
Just using an empty callback like
def callback(*args):
pass
for i in range(10):
producer.send(i+1, f"processed/foo-{i}.txt", b"foo", stream="foo", callback=callback)
avoids the errors.