Closed BewareMyPower closed 1 year ago
It seems to have some bugs, mark it as drafted and I will investigate tomorrow.
@merlimat @RobertIndie @shibd @Demogorgon314 Could anyone take a look?
Hi, @BewareMyPower I'm reviewing the code. I will give feedback soon.
Motivation
Currently, when a blocking API is interrupted by a signal,
SystemError
will be thrown. However, in this case,PyErr_SetInterrupt
will be called and next time a blocking API is called,std::system_error
will be somehow thrown.The failure of https://lists.apache.org/thread/cmzykd9qz9x1d0s35nc5912o3slwpxpv is caused by this issue. The
SystemError
is not called, thenclient.close()
will be skipped, which leads to thebad_weak_ptr
error.P.S. Currently we have to call
client.close()
on aClient
instance, otherwise, thebad_weak_ptr
will be thrown.However, even if we caught the
SystemError
like:we would still see the following error:
Modifications
ResultInterrupted
into thepulsar.Interrupted
exception.waitForAsyncValue
andwaitForAsyncResult
functions and raisepulsar.Interrupted
whenPyErr_CheckSignals
detects a signal.InterruptedTest
to cover this case.future.h
since we now usestd::future
instead of the manually implementedFuture
.examples/consumer.py
to support stopping by Ctrl+C.