{"action":"opened","issue":{"url":"https://api.github.com/repos/real-logic/Aeron/issues/111","labels_url":"https://api.github.com/repos/real-logic/Aeron/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/real-logic/Aeron/issues/111/comments","events_url":"https://api.github.com/repos/real-logic/Aeron/issues/111/events","html_url":"https://github.com/real-logic/Aeron/issues/111","id":73188201,"number":111,"title":"Creating and then immediately deleting context and Aeron object crashes the JVM","user":{"login":"strangelydim","id":2837339,"avatar_url":"https://avatars.githubusercontent.com/u/2837339?v=3","gravatar_id":"","url":"https://api.github.com/users/strangelydim","html_url":"https://github.com/strangelydim","followers_url":"https://api.github.com/users/strangelydim/followers","following_url":"https://api.github.com/users/strangelydim/following{/other_user}","gists_url":"https://api.github.com/users/strangelydim/gists{/gist_id}","starred_url":"https://api.github.com/users/strangelydim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strangelydim/subscriptions","organizations_url":"https://api.github.com/users/strangelydim/orgs","repos_url":"https://api.github.com/users/strangelydim/repos","events_url":"https://api.github.com/users/strangelydim/events{/privacy}","received_events_url":"https://api.github.com/users/strangelydim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-05T03:10:36Z","updated_at":"2015-05-05T03:10:36Z","closed_at":null,"body":"This code:\r\n\r\n```\r\nimport uk.co.real_logic.aeron.Aeron;\r\nimport uk.co.real_logic.aeron.Aeron.Context;\r\n\r\npublic class CreateDeleteTest\r\n{\r\n    public static void main(final String[] args)\r\n    {\r\n        final Context ctx = new Aeron.Context();\r\n        final Aeron aeron = Aeron.connect(ctx);\r\n\r\n        aeron.close();\r\n        ctx.close();\r\n        System.out.println(\"Done!\");\r\n    }\r\n}\r\n```\r\n\r\nCrashes the JVM for me, on my Mac, in different places; the hs_err report for one example crash includes:\r\n\r\n```\r\n# Problematic frame:\r\n# Done!\r\nV  [libjvm.dylib+0x54a3e8]  Unsafe_GetLongVolatile+0x3e\r\n```\r\n\r\nand the interesting thread in the jstack output for the corresponding core file is:\r\n\r\n```\r\nThread 21763: (state = IN_VM)\r\n - sun.misc.Unsafe.getLongVolatile(java.lang.Object, long) @bci=0 (Interpreted frame)\r\n - uk.co.real_logic.agrona.concurrent.UnsafeBuffer.getLongVolatile(int) @bci=21, line=347 (Interpreted frame)\r\n - uk.co.real_logic.agrona.concurrent.broadcast.BroadcastReceiver.receiveNext() @bci=12, line=149 (Interpreted frame)\r\n - uk.co.real_logic.agrona.concurrent.broadcast.CopyBroadcastReceiver.receive(uk.co.real_logic.agrona.concurrent.MessageHandler) @bci=14, line=62 (Interpreted frame)\r\n - uk.co.real_logic.aeron.DriverListenerAdapter.receiveMessages(long) @bci=10, line=56 (Interpreted frame)\r\n - uk.co.real_logic.aeron.ClientConductor.doWork() @bci=18, line=104 (Interpreted frame)\r\n - uk.co.real_logic.agrona.concurrent.AgentRunner.run() @bci=42, line=83 (Interpreted frame)\r\n - java.lang.Thread.run() @bci=11, line=745 (Interpreted frame)\r\n```\r\n\r\nIt doesn't appear to really matter if a Media Driver is running or not; it crashes either way.  The original version of the test launched an embedded media driver and tried to close it as well, but that's not necessary to reproduce the crash."}}