{"action":"opened","issue":{"url":"https://api.github.com/repos/ben-manes/caffeine/issues/10","labels_url":"https://api.github.com/repos/ben-manes/caffeine/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/ben-manes/caffeine/issues/10/comments","events_url":"https://api.github.com/repos/ben-manes/caffeine/issues/10/events","html_url":"https://github.com/ben-manes/caffeine/issues/10","id":68655425,"number":10,"title":"SingleConsumerQueue::size can return over-flowed int size","user":{"login":"nitsanw","id":2692655,"avatar_url":"https://avatars.githubusercontent.com/u/2692655?v=3","gravatar_id":"","url":"https://api.github.com/users/nitsanw","html_url":"https://github.com/nitsanw","followers_url":"https://api.github.com/users/nitsanw/followers","following_url":"https://api.github.com/users/nitsanw/following{/other_user}","gists_url":"https://api.github.com/users/nitsanw/gists{/gist_id}","starred_url":"https://api.github.com/users/nitsanw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nitsanw/subscriptions","organizations_url":"https://api.github.com/users/nitsanw/orgs","repos_url":"https://api.github.com/users/nitsanw/repos","events_url":"https://api.github.com/users/nitsanw/events{/privacy}","received_events_url":"https://api.github.com/users/nitsanw/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-15T11:32:33Z","updated_at":"2015-04-15T11:32:33Z","closed_at":null,"body":"This is unlikely, but there's nothing to stop the unbounded queue to grow beyond MAX_INT length and so:\r\n\r\n    @Override\r\n    public int size() {\r\n      Node<E> h = head;\r\n      Node<E> cursor = h.getNextRelaxed();\r\n      int size = 0;\r\n      while (cursor != null) { // should be while (cursor != null && size < MAX_INT)\r\n        cursor = cursor.getNextRelaxed();\r\n        size++;\r\n      }\r\n      return size;\r\n    }\r\n\r\n"}}