The WaitTimeout() function in wxSemaphore and wxCondition (and maybe others) returns immediately instead of waiting for the timeout if system date > 2038-01-19 03:14:07 UTC (aka.: https://en.wikipedia.org/wiki/Year_2038_problem)
I tested wxWidgets 3.2.10 on a VM running Debian 13.4.
To reproduce it, you can compile the following code:
#include <iostream>
#include <iomanip>
#include <wx/event.h>
using namespace std;
int main() {
wxSemaphore sem;
while (1) {
auto t = time(nullptr);
cout << "now: " << put_time(gmtime(&t), "%c") << endl;
if (wxSEMA_TIMEOUT == sem.WaitTimeout(1000))
cout << "got wxSEMA_TIMEOUT" << endl;
}
}
Then, set the system date a few seconds before that time and launch the reproducer.
You may want to do the test inside a VM since you are messing with system date!
sudo timedatectl set-ntp false
sudo timedatectl set-timezone UTC
sudo timedatectl set-time "2038-01-19 03:14:00"
./reproducer
The loop will print one line per second until the SINT32_MAX limit, and then it will print many lines per second because it will no longer wait for the 1000 milliseconds timeout.
now: Tue Jan 19 03:14:00 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:01 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:02 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:03 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:04 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:05 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:06 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
now: Tue Jan 19 03:14:07 2038
got wxSEMA_TIMEOUT
^Ctrl-C
Let me know if I can help with any other information. I'm reporting it now because a migration to a new wxWidgets version might take quite years in downstream applications. Related: amule-project/amule#602
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Thanks, reproduced (with master) simply by using faketime.
I'll have a look if nobody else does.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Fixed in #26469 which will be merged soon and backported to 3.2 a bit later, thanks again for reporting.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Just tested your branch and it is working now as expected. Thanks for your prompt action!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()