{"action":"closed","issue":{"url":"https://api.github.com/repos/ptpd/ptpd/issues/27","repository_url":"https://api.github.com/repos/ptpd/ptpd","labels_url":"https://api.github.com/repos/ptpd/ptpd/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/ptpd/ptpd/issues/27/comments","events_url":"https://api.github.com/repos/ptpd/ptpd/issues/27/events","html_url":"https://github.com/ptpd/ptpd/issues/27","id":182782336,"number":27,"title":"accumulates open sockets if no PTP master is present until no more file descriptors are available","user":{"login":"florian-z","id":20703777,"avatar_url":"https://avatars.githubusercontent.com/u/20703777?v=3","gravatar_id":"","url":"https://api.github.com/users/florian-z","html_url":"https://github.com/florian-z","followers_url":"https://api.github.com/users/florian-z/followers","following_url":"https://api.github.com/users/florian-z/following{/other_user}","gists_url":"https://api.github.com/users/florian-z/gists{/gist_id}","starred_url":"https://api.github.com/users/florian-z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/florian-z/subscriptions","organizations_url":"https://api.github.com/users/florian-z/orgs","repos_url":"https://api.github.com/users/florian-z/repos","events_url":"https://api.github.com/users/florian-z/events{/privacy}","received_events_url":"https://api.github.com/users/florian-z/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-13T12:58:13Z","updated_at":"2016-10-14T10:05:39Z","closed_at":"2016-10-14T10:05:39Z","body":"While running ptpd2 v2.3.2 as slave-only I noticed, that ptpd does stop workingcorrectly when no master has been available for a while (>20h)(test if reproducable is running), or the master reports a time near unix time epoch begin for about 20min (reproducable).\r\n\r\nA) While no master is available it does this in the event log roughly every minute:\r\n\r\n    2016-10-13 12:43:20.057055 ptpd2[5407].eth0 (warning)   (lstn_reset) Still in LISTENING after 5 restarts - restarting transports\r\n    2016-10-13 12:43:20.422848 ptpd2[5407].eth0 (notice)    (lstn_reset) Now in state: PTP_LISTENING\r\n\r\nB) When master is reporting wrong time 01/01/1970 00:xx:xx, then my client dies this every second:\r\n\r\n    2016-10-13 11:00:42.131852 ptpd2[492].eth0 (notice)    (lstn_reset) Now in state: PTP_LISTENING\r\n    2016-10-13 11:00:42.299015 ptpd2[492].eth0 (info)      (lstn_reset) New best master selected: a0369ffffe9240b4(unknown)/1\r\n    2016-10-13 11:00:42.299358 ptpd2[492].eth0 (notice)    (slv) Now in state: PTP_SLAVE, Best master: a0369ffffe9240b4(unknown)/1 (IPv4:192.168.209.236)\r\n    2016-10-13 11:00:42.769114 ptpd2[492].eth0 (notice)    (slv) Received first Sync from Master\r\n    2016-10-13 11:00:42.789209 ptpd2[492].eth0 (critical)  (slv) Offset above 1 second (1476348743.061028957 s). Clock will step.\r\n    2016-10-13 11:00:42.789431 ptpd2[492].eth0 (error)     (slv) Could not set system time      (strerror: Invalid argument)\r\n\r\nFor every A) and B) it also gets two more open sockets, shown below with `lsof`:\r\n\r\n    COMMAND  PID USER   FD   TYPE     DEVICE SIZE/OFF   NODE NAME\r\n    ... <usual ports>\r\n    ptpd2   5407 root   15u  sock        0,8      0t0  11455 can't identify protocol\r\n    ptpd2   5407 root   16u  sock        0,8      0t0  11552 can't identify protocol\r\n    ... <increasing list of shown ports>\r\n\r\nOnce it \"stops working\", this is what the event log shows every ten seconds:\r\n\r\n    2016-10-13 11:13:34.812035 ptpd2[492].eth0 (error)     (init) Could not get interface list      (strerror: Too many open files)\r\n    2016-10-13 11:13:34.812266 ptpd2[492].eth0 (error)     (init) Failed to initialize network\r\n    2016-10-13 11:13:34.812404 ptpd2[492].eth0 (error)     (flt) PTPd init failed - will retry in 10 seconds\r\n\r\n\r\nI looked through the code, but could not find a place, where sockets are left behind / are not closed.\r\n\r\n\r\nAttached the event log of a 20 min run, which ended in the \"stop working\" state. (PTP master falsely reported 01/01/1970 00:00, which caused `ptpd2[492].eth0 (error)     (slv) Could not set system time      (strerror: Invalid argument)` and thus `ptpd2[492].eth0 (notice)    (lstn_reset) Now in state: PTP_LISTENING` is executed twice every second. Thus sockets are used up more quickly.)\r\n[ptpd2_master_wrong_time___ptpd_failed_after_20min.txt](https://github.com/ptpd/ptpd/files/527101/ptpd2_master_wrong_time___ptpd_failed_after_20min.txt)\r\n\r\nAttached the event log and `lsof` output of a 2h run without PTP master, which is still ongoing and likely to fail after 20h (prediction). Will come back to this, once I can reproduce it.\r\n[ptpd2__no_master__2h_elapsed__eventlog.txt](https://github.com/ptpd/ptpd/files/527111/ptpd2__no_master__2h_elapsed__eventlog.txt)\r\n[ptpd2_master_wrong_time___ptpd_failed_after_20min.txt](https://github.com/ptpd/ptpd/files/527103/ptpd2_master_wrong_time___ptpd_failed_after_20min.txt)\r\n"}}
{"actor":{"display_login":"wowczarek"}}