VMware Modern Apps Community
Tukey42
Contributor
Contributor
Jump to solution

Strange time jumps in a docker container

I have a docker image of motion (https://motion-project.github.io/index.html). It is running well under ubuntu.
I want to migrate all my docker images from ubuntu to Photon OS. Unfortunately the same motion image shows a strange behavior under Photon OS 4.0. The timestamp of the log entries of motion are suddenly about 42 minutes too high for a short time (a few seconds or milliseconds). Also the generated mp4 video files (generated with ffmpeg lib) sometimes shows a length which is about 42 minutes too high.

I have no idea, how this could happen. Maybe someone has already seen such behavior or has an idea how such a strange thing can happen.

The motion image itself is based on Ubuntu. motion is written in C and uses threads, but even in one thread, the time jumps.

As already said, any idea is highly appreciated!

Here is a log file extract showing the time jump:

[5:ml5:Freie Kamer] [WRN] [DBL] [Dec 28 23:31:50] dbse_firstmotion: Ignoring empty sql query
[5:ml5:Freie Kamer] [NTC] [EVT] [Dec 28 23:31:51] event_newfile: Writing movie to file: /motion/new/dcs932l/20221228233150.mp4
[10:nc10:Eingang] [ERR] [NET] [Dec 29 00:14:27] netcam_rtsp_handler_reconnect: norm: Reconnecting with camera....
[10:nc10:Eingang] [NTC] [NET] [Dec 28 23:32:31] netcam_rtsp_connect: norm: Camera (Eingang) connected
[3:ml3:Eingang] [NTC] [ALL] [Dec 28 23:32:35] motion_detected: Motion detected - starting event 1.
Reply
0 Kudos
1 Solution

Accepted Solutions
DCasota
Expert
Expert
Jump to solution

Hi @Tukey42 ,

Very nice project, congrats !

Here some thoughts:

- it could be a daylight saving time related issue. Is ntp configured? See a Photon OS ipv4 example below.
  An offending code in the startup code (before netcam_rtsp_handler_reconnect in netcam_rtsp.c) for a time api call right for reconnecting to camera could be the root cause.

https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf
  There is a new spec release. The jpeg header extension has a distinction for wallclock time, ntp support, onvif replay, etc.

 

Btw this is the Photon OS forum for administrative questions purposes. For developer questions, a reproducible test code (docker file, host os specs, recorded mp4 ) would be helpful when opening an issue ticket @ https://github.com/vmware/photon .

 

But, hope this already helps !

 

-----

NTP

tdnf install -y ntp

Add server entries (Here in Switzerland eg. server ntp11.metas.ch, ntp12.metas.ch, ntp13.metas.ch) vi /etc/ntp.conf

tinker panic 0
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
driftfile /var/lib/ntp/drift/ntp.drift

server <your ntp server 1>
server <your ntp server 2>
server <your ntp server 3>
iptables -A INPUT -i eth0 -p udp --dport 123 -j ACCEPT
iptables-save >/etc/systemd/scripts/ip4save
systemctl enable ntpd
systemctl start ntpd

It is also necessary to configure the timezone.

set Europe/Zurich timezone
ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime

Sync now and sync the RTC clock to system clock:

systemctl stop ntpd
ntpdate -s <your ntp server>
systemctl start ntpd
hwclock --systohc --localtime

 

View solution in original post

Reply
0 Kudos
2 Replies
DCasota
Expert
Expert
Jump to solution

Hi @Tukey42 ,

Very nice project, congrats !

Here some thoughts:

- it could be a daylight saving time related issue. Is ntp configured? See a Photon OS ipv4 example below.
  An offending code in the startup code (before netcam_rtsp_handler_reconnect in netcam_rtsp.c) for a time api call right for reconnecting to camera could be the root cause.

https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf
  There is a new spec release. The jpeg header extension has a distinction for wallclock time, ntp support, onvif replay, etc.

 

Btw this is the Photon OS forum for administrative questions purposes. For developer questions, a reproducible test code (docker file, host os specs, recorded mp4 ) would be helpful when opening an issue ticket @ https://github.com/vmware/photon .

 

But, hope this already helps !

 

-----

NTP

tdnf install -y ntp

Add server entries (Here in Switzerland eg. server ntp11.metas.ch, ntp12.metas.ch, ntp13.metas.ch) vi /etc/ntp.conf

tinker panic 0
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
driftfile /var/lib/ntp/drift/ntp.drift

server <your ntp server 1>
server <your ntp server 2>
server <your ntp server 3>
iptables -A INPUT -i eth0 -p udp --dport 123 -j ACCEPT
iptables-save >/etc/systemd/scripts/ip4save
systemctl enable ntpd
systemctl start ntpd

It is also necessary to configure the timezone.

set Europe/Zurich timezone
ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime

Sync now and sync the RTC clock to system clock:

systemctl stop ntpd
ntpdate -s <your ntp server>
systemctl start ntpd
hwclock --systohc --localtime

 

Reply
0 Kudos
Tukey42
Contributor
Contributor
Jump to solution

Hi @DCasota ,

   many thanks for your reply. I thought, that this forum is the best place to ask, because I did not believe, it is really a bug and I also thought, that it would be hard to reproduce.

Nevertheless, your hints pointed me to the right direction. The time of the VMware ESXi host were about 42 minutes of, because I forgot to configure an NTP server. There is no ntp client running on Photon OS nor on the docker container.

After fixing the time on ESXi, the problem disappeared.

Again, many thanks for your help!

 

Best Regards!

Reply
0 Kudos