File Descriptor Race in Logger

Description

A race condition exists whereby Logger::setLogFile can close Logger::fd while Logger:rintThreadMain is using it to write output to log, causing a failure. This occurs because the fd variable is not protected when used by printThreadMain.

That being said, I would consider this a very minor bug since setLogFile is only really used within OptionParser and OptionParser executes before any log messages are produced. This bug only shows up when one runs LogTests.* on a very resource-constrained VM since it rapidly calls into setLogFile between tests.

This bug is reproducible as of commit cd81885.

Environment

None

Status

Assignee

Yilong Li

Reporter

Stephen Yang

Labels

None

Priority

Minor
Configure