[plt-scheme] concurrency bug in tcp-connect
At Thu, 5 Jun 2003 13:38:53 -0400, "Anton van Straaten" wrote:
> A bit of investigation shows that the problem seems to be in the function
> MZ_GETHOSTBYNAME in mzscheme/src/network.c. There's a static buffer,
> ghbn_hostname, which is being written to without any kind of synchronization
> check. Moving this code down into the synchronized section, after
> "ghbn_lock = 1", fixes this problem, and has worked so far in my tests.
> I've appended a diff.
Thanks for tracking down this bug. As the variable names suggest, that
particular lock is indeed supposed to protect that particular buffer!
I modified your patch, slightly: I moved the strlen() test back to the
top of the function (since one branch of the test escapes), but I kept
the strcpy() under the lock.
Matthew