Marko,

I was able to experience some crashes with this test.
They occur once in a while and at random locations...
Sometimes when writing testfile1, and sometimes at the beginning of the program.
Sadly, i was never able to get an usable core file.

Will keep digging,

Cheers,

Gilles

Marko Blatzheim <marko-blatzh...@web.de> wrote:
>Hi Gilles,
>
> 
>
>I checked out openMPI Master 2 weeks ago.
>
>JVM is: java version "1.7.0_25"
>Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
>Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
>
>command line is: mpirun -np 2 java -jar MPI_open.jar
>
> 
>
>The segmentation fault is in the line with: test = is.readObject();
>
> 
>
>
>package mpi_open;
>
>import java.io.ByteArrayInputStream;
>import java.io.FileOutputStream;
>import java.io.IOException;
>import java.io.ObjectInputStream;
>import java.io.ObjectOutputStream;
>import java.io.Serializable;
>import java.util.ArrayList;
>import java.util.Random;
>import mpi.File;
>import mpi.MPI;
>import mpi.MPIException;
>import mpi.Status;
>
>
>public class MPI_open {
>
>
>    public static void main(String[] args) throws MPIException, IOException, 
>ClassNotFoundException {
>       
>        MPI.Init(args);
>        int myRank = MPI.COMM_WORLD.getRank();
>        if (myRank == 0) {
>            // create file
>            int num = 1000000;
>            Random r = new Random(1234);
>            ArrayList<Serializable> obj0 = new ArrayList<>(num);
>            double[] obj1 = new double[num];
>            for (int j = 0; j < num; j++) {
>                double d = r.nextGaussian();
>                obj0.add(d);
>                obj1[j] = d;
>            }
>            obj0.trimToSize();
>
>            System.out.println("objects created");
>
>            java.io.File f = new java.io.File("testfile0");
>            ObjectOutputStream out = null;
>            try {
>                out = new ObjectOutputStream(new FileOutputStream(f));
>                System.out.println("out1");
>                out.writeObject(obj1);
>                System.out.println("out2");
>            } catch (java.lang.ClassCastException x) {
>                throw x;
>            } finally {
>                if (out != null) {
>                    out.close();
>                }
>            }
>
>            System.out.println("file 1 done");
>
>            java.io.File f1 = new java.io.File("testfile1");
>            ObjectOutputStream out1 = null;
>            try {
>                out1 = new ObjectOutputStream(new FileOutputStream(f1));
>                out1.writeObject(obj0);
>            } catch (java.lang.ClassCastException x) {
>                throw x;
>            } finally {
>                if (out1 != null) {
>                    out1.close();
>                }
>            }
>            System.out.println("file 2 done");
>
>            String filename = "testfile1";
>            byte[] readbuf;
>
>            File myfile = new File(MPI.COMM_SELF, filename, MPI.MODE_RDONLY);
>            int filesize = (int) myfile.getSize();
>            readbuf = new byte[filesize];
>            Status status = myfile.read(readbuf, filesize, MPI.BYTE);
>            Object test = null;
>
>            ByteArrayInputStream in = new ByteArrayInputStream(readbuf);
>            ObjectInputStream is = new ObjectInputStream(in);
>            System.out.println("Program fine until this line!");
>            test = is.readObject();
>        }
>
>        MPI.Finalize();
>    }
>}
>
> 
>
>Thanks
>
>Marko
>
> 
>
>Gesendet: Montag, 25. Januar 2016 um 01:04 Uhr
>Von: "Gilles Gouaillardet" <gil...@rist.or.jp>
>An: "Open MPI Users" <us...@open-mpi.org>
>Betreff: Re: [OMPI users] segmentation fault with java MPI
>
>Marko,
>
>i wrote a test program based on your code snippet and it works for me.
>
>could you please :
>- post a standalone test case that is ready to be compiled and ran
>- which version of OpenMPI are you using ?
>- which JVM are you using ? (vendor and version)
>- post your full command line
>
>Cheers,
>
>Gilles
>
>On 1/25/2016 8:23 AM, Marko Blatzheim wrote:
>> String filename = "testfile";
>> byte[] readbuf;
>>
>> File myfile = new File(MPI.COMM_SELF, filename, MPI.MODE_RDONLY);
>> int filesize = (int) myfile.getSize();
>> readbuf = new byte[filesize];
>>
>> byte[] copyarray = new byte[filesize];
>> Status status = myfile.read(readbuf, filesize, MPI.BYTE);
>> Object test = null;
>> if (myrank == 0) {
>> ByteArrayInputStream in = new ByteArrayInputStream(readbuf);
>> ObjectInputStream is = new ObjectInputStream(in);
>> test = is.readObject(); // This line causes a
>> segmnentation fault
>> }
>
>_______________________________________________
>users mailing list
>us...@open-mpi.org
>Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/users
>Link to this post: 
>http://www.open-mpi.org/community/lists/users/2016/01/28360.php
>

Reply via email to