Xt timer call, XtAppAddTimeout, hangs on system clock jump backwards


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Xt timer call, XtAppAddTimeout, hangs on system clock jump backwards
# 1  
Old 07-20-2018
Question Xt timer call, XtAppAddTimeout, hangs on system clock jump backwards

Hi, I've got an issue which I've been 'google-fu'ing without much luck. We have a legacy program which has been plagued by an issue for a long time and I've been tasked to investigate/fix.

The program uses XMotif2.1 (required due to dependency on an old GUI designer) and runs on a RHEL7 machine (previously RHEL 5 and before that RHEL4). Normal GUI event processing relies on a re-entrant Xt callback using the XtAppAddTimeout call. This works fine, unless the system clock is set backwards, which occurs due during an NTP sync of the system (which can happen at any point during the program). When this occurs, it appears as though the program is frozen. According to my research, the way Xt handles timeouts is by determining the expiration time (system time + expiration interval) and waiting until that absolute time is reached, rather than using a monotonic clock. So, if the timer is waiting for a second to elapse, but during the wait the system time is set backwards by 18 minutes, the timer will wait for 18 minutes and 1 second before going off (i.e. reach the original expected expiration time).

I've found very little information on the web about others experiencing this issue and any suggestions for a solution. We've tried detecting the time jump in a separate thread and then attempting to cancel, via XtRemoveTimeout, and then restart the timer. But, we haven't had much luck. The best solution I've heard so far was to manage the timer outside the X event loop and use XtAppAddWorkProc instead.

This might be a long shot. But, does anyone have any experience with this that could provide some insight. TIA
# 2  
Old 07-21-2018
Maybe a slightly different question will resolve your current problem... Why not run ntpd to keep your clock in sync with an NTP server? That should keep jumps in time to jumps of less than a second instead of jumps of more than a quarter of an hour.

Or are you saying that the clock circuit on your system is so screwed up that it is bouncing forwards and backwards by large amounts and ntpd can't keep up?
# 3  
Old 07-21-2018
That's a good question. The system is connected to an ntp server. The user sets their IP address from within the application at which time it connects to the server and the time jump can occur. The time jump isn't happening constantly; just on that initial connection. But, if the time jump is significant, it's a show stopper, where the only remedy is to restart the box/application.
# 4  
Old 07-21-2018
I repeat my question. Why isn't ntpd running on this client all of the time? Why is any application using NTP when it runs instead of the system running ntpd to keep its clock in sync all of the time?
# 5  
Old 07-21-2018
When the system starts up it doesn't have an IP address, so it can't connect to the ntp server. The application requires the user to select the IP address, based on the physical connection point
of the system on the network. At that point, the system connects to the network and the time jump can occur.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

The UNIX clock/timer interrupt

The book The Design of the Unix Operating System speaks of a clock or timer that is used in scheduling. The clock generates interrupts that update priority information for processes and preempt processes in a round-robin fashion. It's apparent that this "clock" is not the same thing as the CPU... (1 Reply)
Discussion started by: Ultrix
1 Replies

2. SCO

System Clock running at half speed

SCO Openserver 6.0.0 had an issue with a NIC losing it's config on reboot. Netconfig would not allow "view protocol" and apparently zeroed out the existing IP info. Repaired from console. After this event, however, the system clock seems to lose 30 seconds for every RTC minute that passes. As a... (1 Reply)
Discussion started by: DoublePanic
1 Replies

3. Solaris

System hangs (freezes) on system bell/beep

I am running OpenIndiana development version oi_148 32-bit on a seven-year-old Dell Inspiron 8600. Seems to be running fine except for one particular annoyance: It freezes whenever a system bell/beep plays. I have mitigated this by turning the system bell off in gnome-terminal, which I use... (3 Replies)
Discussion started by: DeadBadger
3 Replies

4. Solaris

System hangs

Hi, today when i started the OS Sun Solaris 10 it hangs on initialization. Following was shown in the end of the screen Initializing system Please wait.... * Please help? (3 Replies)
Discussion started by: malikshahid85
3 Replies

5. Shell Programming and Scripting

Sync Solaris System Clock With PDC Using Cron

Hi, I currently use the ntpdate and date command to sync the internal clock source of my Solaris systems to the primary domain controller. admin@myserver # ntpdate -d -u 192.168.???.??? 14 Jan 17:42:02 ntpdate: ntpdate 3-5.93e+sun 03/06/05 23:16:45 (1.4) transmit(192.168.???.???)... (2 Replies)
Discussion started by: jamba1
2 Replies

6. Programming

Recv() call with timer(time out )

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any one knows... (2 Replies)
Discussion started by: Rohil
2 Replies

7. Programming

ABOUT RECV() SYSTEM CALL (regarding timer)

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any... (0 Replies)
Discussion started by: Rohil
0 Replies

8. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

9. UNIX for Dummies Questions & Answers

clock() call returning zero always

Hi, Is there a chance that the clock() call returns 0 eternally??? Using BSD. My RTOS application freezes inconsistently only on particular hosts. When debugging it, I came to see that the RTOS timer does not tick at times. The underlying system call is clock() & it always returns zero when the... (4 Replies)
Discussion started by: smanu
4 Replies

10. AIX

AIX 5.3 12 Hour System Clock

Hello Everyone, I have a Domino application running on AIX 5.3 that does time conversions worldwide. It uses the operating system time as a reference for the conversion. My problem is that I need the AIX OS clock to be a 12 hour clock (AM/PM) rather than a 24 hour clock. I have tried the date... (2 Replies)
Discussion started by: RTwitchell
2 Replies
Login or Register to Ask a Question