{"action":"created","issue":{"url":"https://api.github.com/repos/open-mpi/ompi/issues/369","labels_url":"https://api.github.com/repos/open-mpi/ompi/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/open-mpi/ompi/issues/369/comments","events_url":"https://api.github.com/repos/open-mpi/ompi/issues/369/events","html_url":"https://github.com/open-mpi/ompi/issues/369","id":56180232,"number":369,"title":"Persistent communication request provokes segfault in Java bindings.","user":{"login":"osvegis","id":8397035,"avatar_url":"https://avatars.githubusercontent.com/u/8397035?v=3","gravatar_id":"","url":"https://api.github.com/users/osvegis","html_url":"https://github.com/osvegis","followers_url":"https://api.github.com/users/osvegis/followers","following_url":"https://api.github.com/users/osvegis/following{/other_user}","gists_url":"https://api.github.com/users/osvegis/gists{/gist_id}","starred_url":"https://api.github.com/users/osvegis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osvegis/subscriptions","organizations_url":"https://api.github.com/users/osvegis/orgs","repos_url":"https://api.github.com/users/osvegis/repos","events_url":"https://api.github.com/users/osvegis/events{/privacy}","received_events_url":"https://api.github.com/users/osvegis/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/open-mpi/ompi/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/open-mpi/ompi/labels/critical","name":"critical","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"hppritcha","id":7818666,"avatar_url":"https://avatars.githubusercontent.com/u/7818666?v=3","gravatar_id":"","url":"https://api.github.com/users/hppritcha","html_url":"https://github.com/hppritcha","followers_url":"https://api.github.com/users/hppritcha/followers","following_url":"https://api.github.com/users/hppritcha/following{/other_user}","gists_url":"https://api.github.com/users/hppritcha/gists{/gist_id}","starred_url":"https://api.github.com/users/hppritcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hppritcha/subscriptions","organizations_url":"https://api.github.com/users/hppritcha/orgs","repos_url":"https://api.github.com/users/hppritcha/repos","events_url":"https://api.github.com/users/hppritcha/events{/privacy}","received_events_url":"https://api.github.com/users/hppritcha/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/open-mpi/ompi/milestones/8","html_url":"https://github.com/open-mpi/ompi/milestones/Open%20MPI%20v1.10.0","labels_url":"https://api.github.com/repos/open-mpi/ompi/milestones/8/labels","id":1136180,"number":8,"title":"Open MPI v1.10.0","description":"","creator":{"login":"jsquyres","id":617316,"avatar_url":"https://avatars.githubusercontent.com/u/617316?v=3","gravatar_id":"","url":"https://api.github.com/users/jsquyres","html_url":"https://github.com/jsquyres","followers_url":"https://api.github.com/users/jsquyres/followers","following_url":"https://api.github.com/users/jsquyres/following{/other_user}","gists_url":"https://api.github.com/users/jsquyres/gists{/gist_id}","starred_url":"https://api.github.com/users/jsquyres/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsquyres/subscriptions","organizations_url":"https://api.github.com/users/jsquyres/orgs","repos_url":"https://api.github.com/users/jsquyres/repos","events_url":"https://api.github.com/users/jsquyres/events{/privacy}","received_events_url":"https://api.github.com/users/jsquyres/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":8,"state":"open","created_at":"2015-05-27T14:25:41Z","updated_at":"2015-08-12T14:19:29Z","due_on":null,"closed_at":null},"comments":45,"created_at":"2015-02-01T22:00:50Z","updated_at":"2015-08-18T16:05:55Z","closed_at":null,"body":"MPI corrupts the memory space of Java.\r\nThe following example provokes segfault in Java bindings.\r\nPlease, see the comments in the example.\r\n\r\n```java\r\nimport mpi.*;                                                                         \r\nimport java.nio.*;                                                                    \r\n\r\npublic class CrashTest\r\n{\r\n    private static final int STEPS = 1000000000,\r\n        SIZE  = 4096;\r\n\r\n    public static void main(String...args) throws MPIException\r\n    {\r\n        MPI.Init(args);\r\n        int rank = MPI.COMM_WORLD.getRank();\r\n        StringBuilder s = new StringBuilder();\r\n\r\n        if(MPI.COMM_WORLD.getSize() != 2)\r\n            throw new MPIException(\"I need exactly 2 processes.\");\r\n\r\n        // Only one buffer is needed,                                                 \r\n        // but the test works ok if you only use one.                                 \r\n        ByteBuffer sendBuf = MPI.newByteBuffer(SIZE),\r\n            recvBuf = MPI.newByteBuffer(SIZE);\r\n\r\n        Prequest req = MPI.COMM_WORLD.recvInit(recvBuf, SIZE, MPI.BYTE, 0, 0);\r\n\r\n        for(int i = 1; i <= STEPS; i++)\r\n            {\r\n                // Allocate memory to provoke GC work and crash.                      \r\n                // If you comment the following line, the test works ok.              \r\n                (s = new StringBuilder(SIZE).append(i)).trimToSize();\r\n\r\n                if(rank == 0)\r\n                    {\r\n                        if(i % 100000 == 0)\r\n                            {\r\n                                s.setLength(0);\r\n                                System.out.println(i + s.toString());\r\n                            }\r\n\r\n                        MPI.COMM_WORLD.send(sendBuf, SIZE, MPI.BYTE, 1, 0);\r\n                    }\r\n                else\r\n                    {\r\n                        req.start();\r\n                        req.waitFor();\r\n                    }\r\n            }\r\n\r\n        MPI.Finalize();\r\n    }\r\n\r\n} // CrashTest\r\n```"},"comment":{"url":"https://api.github.com/repos/open-mpi/ompi/issues/comments/132261526","html_url":"https://github.com/open-mpi/ompi/issues/369#issuecomment-132261526","issue_url":"https://api.github.com/repos/open-mpi/ompi/issues/369","id":132261526,"user":{"login":"hppritcha","id":7818666,"avatar_url":"https://avatars.githubusercontent.com/u/7818666?v=3","gravatar_id":"","url":"https://api.github.com/users/hppritcha","html_url":"https://github.com/hppritcha","followers_url":"https://api.github.com/users/hppritcha/followers","following_url":"https://api.github.com/users/hppritcha/following{/other_user}","gists_url":"https://api.github.com/users/hppritcha/gists{/gist_id}","starred_url":"https://api.github.com/users/hppritcha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hppritcha/subscriptions","organizations_url":"https://api.github.com/users/hppritcha/orgs","repos_url":"https://api.github.com/users/hppritcha/repos","events_url":"https://api.github.com/users/hppritcha/events{/privacy}","received_events_url":"https://api.github.com/users/hppritcha/received_events","type":"User","site_admin":false},"created_at":"2015-08-18T16:05:54Z","updated_at":"2015-08-18T16:05:54Z","body":"I think what we will probably do is rewrite the direct buffer allocator methods in the MPI class to actually use a native method to create the buffer object.  That plus using the NewGlobalRef method should  prevent the gc from moving/deleting any of the buffers allocated for MPI calls. That hopefully will also solve some of the problems we are seeing trying to reproduce @osvegis results in the ompi java paper.  "}}