{"action":"created","issue":{"url":"https://api.github.com/repos/greenrobot/EventBus/issues/82","repository_url":"https://api.github.com/repos/greenrobot/EventBus","labels_url":"https://api.github.com/repos/greenrobot/EventBus/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/greenrobot/EventBus/issues/82/comments","events_url":"https://api.github.com/repos/greenrobot/EventBus/issues/82/events","html_url":"https://github.com/greenrobot/EventBus/issues/82","id":32252912,"number":82,"title":"Sometimes my registered object gets duplicate events","user":{"login":"fernandocamargoti","id":3669312,"avatar_url":"https://avatars0.githubusercontent.com/u/3669312?v=4","gravatar_id":"","url":"https://api.github.com/users/fernandocamargoti","html_url":"https://github.com/fernandocamargoti","followers_url":"https://api.github.com/users/fernandocamargoti/followers","following_url":"https://api.github.com/users/fernandocamargoti/following{/other_user}","gists_url":"https://api.github.com/users/fernandocamargoti/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandocamargoti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandocamargoti/subscriptions","organizations_url":"https://api.github.com/users/fernandocamargoti/orgs","repos_url":"https://api.github.com/users/fernandocamargoti/repos","events_url":"https://api.github.com/users/fernandocamargoti/events{/privacy}","received_events_url":"https://api.github.com/users/fernandocamargoti/received_events","type":"User","site_admin":false},"labels":[{"id":9503123,"url":"https://api.github.com/repos/greenrobot/EventBus/labels/more%20info%20required","name":"more info required","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2014-04-25T17:52:14Z","updated_at":"2017-09-13T04:23:48Z","closed_at":"2015-11-20T16:48:41Z","author_association":"NONE","body":"I have one Activity and multiple Fragments. One of the fragments takes care of the Menu and trade messages with my Activity to ask for the Activity to change the content's fragment based on some selection of a Menu.\n\nSometimes, when I open my app, my Activity receives duplicate events. It only happens rarely, but it causes a great issue, since the fragment that was requested to be set as the content of the Activity is replace twice. This causes a race condition in my Loader and my app crashes. I tried to take care of this race condition, but I can't. So I decided to look into the root of the problem, that was the duplicate events and I can't find what's the cause.\n\nYou can see this in this log:\n\n04-25 14:22:44.375    7565-7565/com.meubilhete D/EventBus﹕ Registered sticky: DrawerActivity\n04-25 14:22:44.375    7565-7565/com.meubilhete D/DrawerActivity﹕ Changing content: GerenciarEntradaFragment.\n04-25 14:22:44.375    7565-7565/com.meubilhete D/DrawerActivity﹕ Changing content: GerenciarEntradaFragment.\n04-25 14:22:44.375    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: MenuSelecionadoEvent.\n04-25 14:22:44.375    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: MenuSelecionadoEvent.\n04-25 14:22:44.385    7565-7565/com.meubilhete D//SpiceManager.java:212﹕ 14:22:44.387 main SpiceManager started.\n04-25 14:22:44.385    7565-7565/com.meubilhete D/GerenciarEntradaFragment﹕ onAttach()\n04-25 14:22:44.385    7565-7565/com.meubilhete D/GerenciarEntradaFragment﹕ onActivityCreated()\n04-25 14:22:44.395    7565-7565/com.meubilhete D/EventBus﹕ Registered sticky: MenuFragment\n04-25 14:22:44.395    7565-7565/com.meubilhete D/EventBus﹕ Registered sticky: GerenciarEntradaFragment\n04-25 14:22:44.395    7565-7565/com.meubilhete D/GerenciarEntradaFragment﹕ onStart()\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: FragmentVisivelEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: FragmentVisivelEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: RequisitouSelecaoDeMenuEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: RequisitouSelecaoDeMenuEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Changing content: MeusEventosFragment.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Changing content: MeusEventosFragment.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: MenuSelecionadoEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: MenuSelecionadoEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Changing content: MeusEventosFragment.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Changing content: MeusEventosFragment.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: MenuSelecionadoEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/DrawerActivity﹕ Launched event: MenuSelecionadoEvent.\n04-25 14:22:44.395    7565-7565/com.meubilhete D/EventBus﹕ Unregistered: GerenciarEntradaFragment\n\nI've extended the EventBus to log when some class is registered and the Activity is registered only once. The EventBus is a singleton in the app. In my DrawerActivity, I've put a method that listens to any event (onEvent(Object event)) and logs it. It's logging twice the events and the part of the log that says \"Changing content\" is due to my method being called after a duplicate event.\n\nAs I said, it happens sometimes, not always. It's really hard to simulate.\n"},"comment":{"url":"https://api.github.com/repos/greenrobot/EventBus/issues/comments/329055083","html_url":"https://github.com/greenrobot/EventBus/issues/82#issuecomment-329055083","issue_url":"https://api.github.com/repos/greenrobot/EventBus/issues/82","id":329055083,"user":{"login":"david-alejandro-reyes-milian","id":16763341,"avatar_url":"https://avatars3.githubusercontent.com/u/16763341?v=4","gravatar_id":"","url":"https://api.github.com/users/david-alejandro-reyes-milian","html_url":"https://github.com/david-alejandro-reyes-milian","followers_url":"https://api.github.com/users/david-alejandro-reyes-milian/followers","following_url":"https://api.github.com/users/david-alejandro-reyes-milian/following{/other_user}","gists_url":"https://api.github.com/users/david-alejandro-reyes-milian/gists{/gist_id}","starred_url":"https://api.github.com/users/david-alejandro-reyes-milian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-alejandro-reyes-milian/subscriptions","organizations_url":"https://api.github.com/users/david-alejandro-reyes-milian/orgs","repos_url":"https://api.github.com/users/david-alejandro-reyes-milian/repos","events_url":"https://api.github.com/users/david-alejandro-reyes-milian/events{/privacy}","received_events_url":"https://api.github.com/users/david-alejandro-reyes-milian/received_events","type":"User","site_admin":false},"created_at":"2017-09-13T04:23:48Z","updated_at":"2017-09-13T04:23:48Z","author_association":"NONE","body":"I solved my issue here. It was nothing related to EventBus. I was registering multiple times my EventListeners, so duplicating my messages. EventBus was receiving a duplicated set of events. Cheers!"}}
{"actor":{"display_login":"david-alejandro-reyes-milian"}}