{"action":"opened","issue":{"url":"https://api.github.com/repos/Netflix/servo/issues/359","labels_url":"https://api.github.com/repos/Netflix/servo/issues/359/labels{/name}","comments_url":"https://api.github.com/repos/Netflix/servo/issues/359/comments","events_url":"https://api.github.com/repos/Netflix/servo/issues/359/events","html_url":"https://github.com/Netflix/servo/issues/359","id":110060786,"number":359,"title":"Race condition with GC in constructors for DoubleGauge and LongGauge","user":{"login":"nedgar","id":692834,"avatar_url":"https://avatars.githubusercontent.com/u/692834?v=3","gravatar_id":"","url":"https://api.github.com/users/nedgar","html_url":"https://github.com/nedgar","followers_url":"https://api.github.com/users/nedgar/followers","following_url":"https://api.github.com/users/nedgar/following{/other_user}","gists_url":"https://api.github.com/users/nedgar/gists{/gist_id}","starred_url":"https://api.github.com/users/nedgar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nedgar/subscriptions","organizations_url":"https://api.github.com/users/nedgar/orgs","repos_url":"https://api.github.com/users/nedgar/repos","events_url":"https://api.github.com/users/nedgar/events{/privacy}","received_events_url":"https://api.github.com/users/nedgar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-06T17:38:02Z","updated_at":"2015-10-06T17:38:02Z","closed_at":null,"body":"DoubleGauge and LongGauge are subclasses of NumberGauge, which uses a WeakReference to the Number. The subclass constructors then get the Number using getBackingNumber() and store it as a strong reference, so it won't be GCed. However, if the GC runs between the call to super and the call to getBackingNumber(), the result will likely be null, causing NPEs in the methods that reference number.\r\n\r\nI was able to demonstrate this in the debugger by setting a breakpoint where the number field is assigned, and forcing a GC. The weak ref gets cleared."}}