Hi Davi,
Davi Arnaut, 20.01.2009 21:22:
...
> On 1/11/09 4:05 PM, Ingo Struewing wrote:
...
>> 2749 Ingo Struewing 2009-01-11
>> Bug#37780 - main.kill fails randomly
>>
>> The test case main.kill did not work reliably.
...
> Is there anything that prevents the thread being killed to try to read
> or write to the "closed" socket? For example, a re-using case:
>
> thr1> sleeping right before a write(fd=10)
> thr2> kill thr1
> thr2> close(fd=10)
> thr0> new connection, fd=accept()=10
> thr1> awakes, write(fd=10)
>
> What happens if we close one direction of a SSL connection?
Due to the many open questions, which require a lot of testing on many
platforms for definite answers, I decided to abstain from the
one-direction close.
I did even try to leave the closing alone altogether. Unfortunately, one
of the tests failed. When the kill comes in short before the
read()/recv(), it is lost.
I did some deeper investigation of the full close option. I found that
the above scenario is not possible. Killing a thread is done by
thd_to_kill->awake(). THD::awake() is thus executed on the object
thd_to_kill. It runs close_active_vio(), which calls
vio_close(active_vio) with the active_vio object from thd_to_kill.
vio_close() in turn sets vio->sd= -1, where 'vio' is the active_vio
object from thd_to_kill. That is, it invalidates the socket/file
descriptor of that thread's connection. It is not possible that the
killed thread writes anything into this socket/file descriptor later.
If my analyze is correct, it should be safe to close one thread's
connection from another thread.
Implementing it, fixed the problem at least.
...
I made new patches:
http://lists.mysql.com/commits/67570 The main kill problem.
http://lists.mysql.com/commits/67342 Removal of obsolete enum value.
http://lists.mysql.com/commits/67415 Debug Sync Facility update.
I think you did already approve the latter two in principle, but I
better ask one time too much than one time too less.
Regards
Ingo
--
Ingo Strüwing, Database Group
Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schröder, Wolfgang Engels, Dr. Roland Bömer
Vorsitzender des Aufsichtsrates: Martin Häring HRB München 161028