{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2507","repository_url":"https://api.github.com/repos/ethereum/go-ethereum","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2507/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2507/comments","events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2507/events","html_url":"https://github.com/ethereum/go-ethereum/issues/2507","id":152478633,"number":2507,"title":"Client ends up with empty peer list after several hours","user":{"login":"pnomarev","id":9689862,"avatar_url":"https://avatars.githubusercontent.com/u/9689862?v=3","gravatar_id":"","url":"https://api.github.com/users/pnomarev","html_url":"https://github.com/pnomarev","followers_url":"https://api.github.com/users/pnomarev/followers","following_url":"https://api.github.com/users/pnomarev/following{/other_user}","gists_url":"https://api.github.com/users/pnomarev/gists{/gist_id}","starred_url":"https://api.github.com/users/pnomarev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnomarev/subscriptions","organizations_url":"https://api.github.com/users/pnomarev/orgs","repos_url":"https://api.github.com/users/pnomarev/repos","events_url":"https://api.github.com/users/pnomarev/events{/privacy}","received_events_url":"https://api.github.com/users/pnomarev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ethereum/go-ethereum/labels/network","name":"network","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/29","html_url":"https://github.com/ethereum/go-ethereum/milestones/1.4.1","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/29/labels","id":1721558,"number":29,"title":"1.4.1","description":"","creator":{"login":"fjl","id":6915,"avatar_url":"https://avatars.githubusercontent.com/u/6915?v=3","gravatar_id":"","url":"https://api.github.com/users/fjl","html_url":"https://github.com/fjl","followers_url":"https://api.github.com/users/fjl/followers","following_url":"https://api.github.com/users/fjl/following{/other_user}","gists_url":"https://api.github.com/users/fjl/gists{/gist_id}","starred_url":"https://api.github.com/users/fjl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fjl/subscriptions","organizations_url":"https://api.github.com/users/fjl/orgs","repos_url":"https://api.github.com/users/fjl/repos","events_url":"https://api.github.com/users/fjl/events{/privacy}","received_events_url":"https://api.github.com/users/fjl/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":7,"state":"open","created_at":"2016-04-20T21:44:45Z","updated_at":"2016-05-02T19:26:29Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-05-02T04:08:50Z","updated_at":"2016-05-03T02:08:50Z","closed_at":null,"body":"#### System information\r\n\r\nGeth version: 1.3.6\r\nOS & Version: Windows\r\n\r\n#### Expected behaviour\r\n\r\nMaintain peers list\r\n\r\n#### Actual behaviour\r\n\r\nAt some point stops peer discovery(most likely to happen during full sync, less likely when the node is fully synchronized)\r\nIn the main server cycle, when `newTasks` decided to perform discoveryTask, this task may not make it to the scheduled tasks(if active tasks count >= maxActiveDialTasks). As a result, `newTasks` still thinks that discoveryTask was initiated, and the whole discovery process stops until client's restart.\r\n\r\np2p/server.go:\r\n\r\n        scheduleTasks := func(new []task) {\r\n\t\tpt := append(pendingTasks, new...)\r\n\t\tstart := maxActiveDialTasks - len(tasks)\r\n\t\tif len(pt) < start {\r\n\t\t\tstart = len(pt)\r\n\t\t}\r\n\t\tif start > 0 {\r\n\t\t\t...\r\n\t\t} \r\n                //// This part is missing\r\n                else {\r\n\t\t\tpendingTasks = append(pendingTasks, new...)\r\n\t\t}\r\n                //////////////////////////////////////\r\n\t}"},"comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments/216417337","html_url":"https://github.com/ethereum/go-ethereum/issues/2507#issuecomment-216417337","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2507","id":216417337,"user":{"login":"pnomarev","id":9689862,"avatar_url":"https://avatars.githubusercontent.com/u/9689862?v=3","gravatar_id":"","url":"https://api.github.com/users/pnomarev","html_url":"https://github.com/pnomarev","followers_url":"https://api.github.com/users/pnomarev/followers","following_url":"https://api.github.com/users/pnomarev/following{/other_user}","gists_url":"https://api.github.com/users/pnomarev/gists{/gist_id}","starred_url":"https://api.github.com/users/pnomarev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnomarev/subscriptions","organizations_url":"https://api.github.com/users/pnomarev/orgs","repos_url":"https://api.github.com/users/pnomarev/repos","events_url":"https://api.github.com/users/pnomarev/events{/privacy}","received_events_url":"https://api.github.com/users/pnomarev/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T02:08:50Z","updated_at":"2016-05-03T02:08:50Z","body":"Looks like your mentioned commit solves the problem I described, although I haven't tested it yet.\r\nThe problem can be reproduced by simply running the client behind the firewall and thus preventing incoming connections on port 30303. This would prevent other peers to connect to you.\r\nNow, once your client have \"discoverTask\" appearing in the scheduled tasks, your client will continuously discover new peers and connect to them.\r\nBut, once this discoverTask is dropped due to mentioned bug(didn't make it to the queue), your client stops getting new peers and looses all of them after some time.\r\n\r\nOverall, to reproduce the issue - simply start fresh geth client without any local database with your 30303 port closed for incoming connections ( probably the majority of peers ).\r\n"}}