{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/8116","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-native","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/8116/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/8116/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/8116/events","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/8116","id":208742736,"number":8116,"title":"Setting marker position in loop results in crash (Fatal signal 11 (SIGSEGV))","user":{"login":"shantanu-vyas","id":1009536,"avatar_url":"https://avatars.githubusercontent.com/u/1009536?v=3","gravatar_id":"","url":"https://api.github.com/users/shantanu-vyas","html_url":"https://github.com/shantanu-vyas","followers_url":"https://api.github.com/users/shantanu-vyas/followers","following_url":"https://api.github.com/users/shantanu-vyas/following{/other_user}","gists_url":"https://api.github.com/users/shantanu-vyas/gists{/gist_id}","starred_url":"https://api.github.com/users/shantanu-vyas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shantanu-vyas/subscriptions","organizations_url":"https://api.github.com/users/shantanu-vyas/orgs","repos_url":"https://api.github.com/users/shantanu-vyas/repos","events_url":"https://api.github.com/users/shantanu-vyas/events{/privacy}","received_events_url":"https://api.github.com/users/shantanu-vyas/received_events","type":"User","site_admin":false},"labels":[{"id":143173729,"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/Android","name":"Android","color":"000000","default":false},{"id":173948013,"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/labels/crash","name":"crash","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-02-19T20:11:23Z","updated_at":"2017-02-20T17:16:19Z","closed_at":"2017-02-20T17:16:19Z","body":"While updating a markers position in a threaded loop at a rate of once ever 500ms mapbox will crash with a sigsegv after some variant amount of time. The code would look something like this \r\n\r\n`public void tempUpdateMarkers()\r\n    {\r\n          Marker marker = mMapboxMap.addMarker(new MarkerOptions().position(new LatLng(0,0).title(\"marker\"));         \r\n        Runnable markerRun = new Runnable() {\r\n            @Override\r\n            public void run() {\r\n                marker.setPosition(new LatLng(marker.getPosition().getLatitude()+.001,marker.getPosition().getLongitude()+.001));\r\n            }\r\n        };\r\n        ScheduledThreadPoolExecutor exec = new ScheduledThreadPoolExecutor(1);\r\n        exec.scheduleAtFixedRate(markerRun, 0, 500, TimeUnit.MILLISECONDS);\r\n    }`\r\n\r\nShould this be handled with a animator instead? \r\n\r\n**Platform: Samsung Galaxy S Tab2, have also tested on Amazon fire 10inch**\r\n**Mapbox SDK version:4.2.2 stable**\r\n\r\n### Steps to trigger behavior\r\n\r\n 1. Update a markers location in some kind of loop at a fixed interval of time\r\n 2. Run app\r\n 3. Wait for crash, occurs at varying amount of times from a couple seconds to a couple minutes\r\n\r\n### Expected behavior\r\nMarker will update position indefinitely. \r\n### Actual behavior\r\nApp crashes \r\nA/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 687 (pool-3-thread-1)"},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/comments/281135548","html_url":"https://github.com/mapbox/mapbox-gl-native/issues/8116#issuecomment-281135548","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-native/issues/8116","id":281135548,"user":{"login":"tobrun","id":2151639,"avatar_url":"https://avatars.githubusercontent.com/u/2151639?v=3","gravatar_id":"","url":"https://api.github.com/users/tobrun","html_url":"https://github.com/tobrun","followers_url":"https://api.github.com/users/tobrun/followers","following_url":"https://api.github.com/users/tobrun/following{/other_user}","gists_url":"https://api.github.com/users/tobrun/gists{/gist_id}","starred_url":"https://api.github.com/users/tobrun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tobrun/subscriptions","organizations_url":"https://api.github.com/users/tobrun/orgs","repos_url":"https://api.github.com/users/tobrun/repos","events_url":"https://api.github.com/users/tobrun/events{/privacy}","received_events_url":"https://api.github.com/users/tobrun/received_events","type":"User","site_admin":false},"created_at":"2017-02-20T17:16:19Z","updated_at":"2017-02-20T17:16:19Z","body":"@shantanu-vyas, \r\n@jfirebaugh remark is on point. Porting your code to a main thread equivalent would be:\r\n\r\n```java\r\n        final Handler handler = new Handler();\r\n        final Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(0, 0)));\r\n        Runnable markerRun = new Runnable() {\r\n          @Override\r\n          public void run() {\r\n            marker.setPosition(new LatLng(marker.getPosition().getLatitude() + .001,\r\n              marker.getPosition().getLongitude() + .001));\r\n            handler.postDelayed(this, 500);\r\n          }\r\n        };\r\n        handler.post(markerRun);\r\n```\r\n\r\nWasn't able to reproduce your crash with this code.\r\nThank you for reaching out, closing this issue as resolved. \r\n\r\n\r\n"}}
{"actor":{"display_login":"tobrun"}}