vagetablechicken opened a new issue #3204: usleep() is obsolete, and may be set the wrong interval by integer overflow URL: https://github.com/apache/incubator-doris/issues/3204 We use usleep() in several places in Doris. But usleep() has many problems. 1. 4.3BSD, POSIX.1-2001. POSIX.1-2001 declares this function obsolete. And POSIX.1-2008 removes the specification of usleep(). It's obsolete. [link here](https://linux.die.net/man/3/usleep) 1. usleep interval is `useconds_t`, an unsigned integer type. If integer overflow, we will set the wrong interval. For exmaple, before 64a06ea9d4550e1d34a9b0ca3d103cf2bbc26970, we use `usleep(interval * 1000000);` in `void* StorageEngine::_path_gc_thread_callback(void* arg)`. the default interval is 86400s, means one day. But `interval * 1000000` will occur integer overflow. The actual code is `usleep(500654080)`, about 500s. So if be's version is before 64a06ea9d4550e1d34a9b0ca3d103cf2bbc26970, we do path gc per 500s. We have fixed path gc interval, but there are still lots of usleep(). The better way is use std::chrono. So I want to replace all usleep() in Doris code.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org