Photon OS

 View Only
  • 1.  Strange time jumps in a docker container

    Posted Dec 28, 2022 10:39 PM

    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:



  • 2.  RE: Strange time jumps in a docker container
    Best Answer

    Posted Jan 01, 2023 05:32 PM

    Hi  ,

    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

     



  • 3.  RE: Strange time jumps in a docker container

    Posted Jan 01, 2023 10:38 PM

    Hi  ,

       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!