Re: API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Leif Hedstrom
Good points. And, is here even a reason to keep our own thread APIs? We only support posix threads anyways. — Leif > On Feb 28, 2019, at 21:46, James Peach wrote: > > > >> On Feb 28, 2019, at 9:17 AM, Fei Deng wrote: >> >> void TSThreadSetCancelState(TSThread thread, int state); >> void

Re: API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread James Peach
> On Feb 28, 2019, at 9:17 AM, Fei Deng wrote: > > void TSThreadSetCancelState(TSThread thread, int state); > void TSThreadSetCancelType(TSThread thread, int type); I guess you are supposed to pass PTHREAD_CANCEL_* for type type parameter? I don't like how this leaks the pthread implementati

Re: API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Fei Deng
So something like this: while (!plugin_threads.empty()) { TSThread th = plugin_threads.front(); // Cancel the threads, then call join to make sure they actually are stopped. TSThreadCancel(th); TSThreadJoin(th); plugin_threads.pop(); } On Thu, Feb 28, 2019 at 2:55

Re: API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Fei Deng
Use case right now is for the ssl_session_reuse plugin, it's crashing during shutdown and the reason is one or more thread of it is lingering just a bit too long and with openssl-1.1.1 it will crash. The current way is to set a flag but there are threads that sleeps up to 30 seconds, or if the timi

Re: API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Leif Hedstrom
> On Feb 28, 2019, at 9:17 AM, Fei Deng wrote: > > void TSThreadSetCancelState(TSThread thread, int state); > void TSThreadSetCancelType(TSThread thread, int type); > void TSThreadCancel(TSThread thread); > void *TSThreadJoin(TSThread thread); That’s a lot of APIs for something that sounds “

Re: API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Fei Deng
I thought about doing that, but that requires a lot of inter thread communication, and we might need to change all the other threads to do it the new way. It could be a better way moving forward, but these apis will solve the problem right now and we can fix the real problem later. On Thu, Feb 28,

API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Fei Deng
void TSThreadSetCancelState(TSThread thread, int state); void TSThreadSetCancelType(TSThread thread, int type); void TSThreadCancel(TSThread thread); void *TSThreadJoin(TSThread thread); Some plugins have been causing a lot of crashes during ATS shutdown, the root cause is due plugin threads are n

Re: API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Walt Karas
Maybe we should have two different types of shutdowns? Analogous to the difference between 'kill' and 'kill -9'. If we wanted to have a really crude but effective approach: // Increment this just before you start doing something you don't want a shutdown to leave partially done. // Decrement it

API Proposal: TSThreadSetCancelState, TSThreadSetCancelType, TSThreadCancel, TSThreadJoin

2019-02-28 Thread Fei Deng
void TSThreadSetCancelState(TSThread thread, int state); void TSThreadSetCancelType(TSThread thread, int type); void TSThreadCancel(TSThread thread); void *TSThreadJoin(TSThread thread); Some plugins have been causing a lot of crashes during ATS shutdown, the root cause is due plugin threads are n