kcruci
2008-Nov-03 13:39 UTC
[Lustre-devel] java successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_().
Hi all, I follow the JNI rules to write Javawrapper for the liblustre code, java seems successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_(). Here is my filelist: *org.lustre.liblustre.test.MkDir.java org_lustre_liblustre_test_MkDir.h org_lustre_liblustre_test_MkDir.c liblustremkdir.so.1.0 *liblustre.a libcap.so.1.10 libpthread-2.5.so libz.so.1.2.3 =================================================== Now, I would try to explain my steps by using JNI. :-( Maybe some compile mistake I was made in the following steps. First, I write i java class and use command "Javah" to generate *org_lustre_liblustre_test_MkDir.h, *whose functions should be implemented in org_lustre_liblustre_test_MkDir.c. Here is just a small part of my *org_lustre_liblustre_test_MkDir.c*, like sanity.c it calls __liblustre_setup_()and__liblustre_cleanup_(). [root at grid JNItests]# vim *org_lustre_liblustre_test_MkDir.c * #include <jni.h> #include "org_lustre_liblustre_test_MkDir.h" extern void __liblustre_setup_(void); extern void __liblustre_cleanup_(void); JNIEXPORT void JNICALL Java_org_lustre_liblustre_test_MkDir_init(JNIEnv * env, jclass inclass) { printf("just kick!\n"); __liblustre_setup_(); printf("liblustre setup!!\n"); __liblustre_cleanup_(); return; } ......... [root at grid JNItests]# vim *org/lustre/liblustre/test/MkDir.java .... System.loadLibrary("lustremkdir");... * =================================================== Second, I use gcc to build the corresponding ****.o file: gcc -I/$JAVA_HOME/include -I/$JAVA_HOME/include/linux -shared -fPIC -c *org_lustre_liblustre_test_MkDir.c *=================================================== Third, I use gcc to build a shared *liblustremkdir.so.1.0, *and cp it to /usr/lib/. gcc -shared -I/$JAVA_HOME/include -I/$JAVA_HOME/include/linux -Wl,-soname,liblustremkdir.so.1 -o *liblustremkdir.so.1.0* org_lustre_liblustre_test_MkDir.o liblustre.a libcap.so.1.10 libpthread-2.5.so libz.so.1.2.3 =================================================== Finally, the Java load the *liblustremkdir.so.1.0* and try to run. [root at grid JNItests]# java org.lustre.liblustre.test.MkDir begin to run Native method ... 1225417124.467324:6009:grid.scut.edu.cn:(class_obd.c: 543:init_obdclass()): Lustre: 6009-grid.scut.edu.cn:(class_obd.c:543:init_obdclass()): OBD class driver, http://www.lustre.org/ 1225417124.467374:6009:grid.scut.edu.cn:(class_obd.c: 544:init_obdclass()): Lustre: 6009-grid.scut.edu.cn:(class_obd.c:544:init_obdclass()): Lustre Version: 1.9.80 1225417124.467400:6009:grid.scut.edu.cn:(class_obd.c: 545:init_obdclass()): Lustre: 6009-grid.scut.edu.cn:(class_obd.c:545:init_obdclass()): Build Version: 1.9.80-20081019111435-CHANGED-.usr.src.linux-2.6.18-92.1.10-2.6.18- prep Lustre mount failed: Invalid argument =================================================== Java seems call the c code successfully. But the above error, after many hard works, still exists. Thanks! Ya-Jian Luan
kcruci
2008-Nov-03 13:48 UTC
[Lustre-devel] java successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_().
Hi all, I follow the JNI rules to write Javawrapper for the liblustre code, java seems successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_(). Here is my filelist: *org.lustre.liblustre.test.MkDir.java org_lustre_liblustre_test_MkDir.h org_lustre_liblustre_test_MkDir.c liblustremkdir.so.1.0 *liblustre.a libcap.so.1.10 libpthread-2.5.so libz.so.1.2.3 =================================================== Now, I would try to explain my steps by using JNI. :-( Maybe some compile mistake I was made in the following steps. First, I write i java class and use command "Javah" to generate *org_lustre_liblustre_test_MkDir.h, *whose functions should be implemented in org_lustre_liblustre_test_MkDir.c. Here is just a small part of my *org_lustre_liblustre_test_MkDir.c*, like sanity.c it calls __liblustre_setup_()and__liblustre_cleanup_(). [root at grid JNItests]# vim *org_lustre_liblustre_test_MkDir.c * #include <jni.h> #include "org_lustre_liblustre_test_MkDir.h" extern void __liblustre_setup_(void); extern void __liblustre_cleanup_(void); JNIEXPORT void JNICALL Java_org_lustre_liblustre_test_MkDir_init(JNIEnv * env, jclass inclass) { printf("just kick!\n"); __liblustre_setup_(); printf("liblustre setup!!\n"); __liblustre_cleanup_(); return; } ......... [root at grid JNItests]# vim *org/lustre/liblustre/test/MkDir.java .... System.loadLibrary("lustremkdir");... * =================================================== Second, I use gcc to build the corresponding ****.o file: gcc -I/$JAVA_HOME/include -I/$JAVA_HOME/include/linux -shared -fPIC -c *org_lustre_liblustre_test_MkDir.c *=================================================== Third, I use gcc to build a shared *liblustremkdir.so.1.0, *and cp it to /usr/lib/. gcc -shared -I/$JAVA_HOME/include -I/$JAVA_HOME/include/linux -Wl,-soname,liblustremkdir.so.1 -o *liblustremkdir.so.1.0* org_lustre_liblustre_test_MkDir.o liblustre.a libcap.so.1.10 libpthread-2.5.so libz.so.1.2.3 =================================================== Finally, the Java load the *liblustremkdir.so.1.0* and try to run. [root at grid JNItests]# java org.lustre.liblustre.test.MkDir begin to run Native method ... 1225417124.467324:6009:grid.scut.edu.cn:(class_obd.c: 543:init_obdclass()): Lustre: 6009-grid.scut.edu.cn:(class_obd.c:543:init_obdclass()): OBD class driver, http://www.lustre.org/ 1225417124.467374:6009:grid.scut.edu.cn:(class_obd.c: 544:init_obdclass()): Lustre: 6009-grid.scut.edu.cn:(class_obd.c:544:init_obdclass()): Lustre Version: 1.9.80 1225417124.467400:6009:grid.scut.edu.cn:(class_obd.c: 545:init_obdclass()): Lustre: 6009-grid.scut.edu.cn:(class_obd.c:545:init_obdclass()): Build Version: 1.9.80-20081019111435-CHANGED-.usr.src.linux-2.6.18-92.1.10-2.6.18- prep Lustre mount failed: Invalid argument =================================================== Java seems call the c code successfully. But the above error, after many hard works, still exists. Thanks! Ya-Jian Luan
Brian J. Murrell
2008-Nov-04 13:48 UTC
[Lustre-devel] java successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_().
On Mon, 2008-11-03 at 05:39 -0800, kcruci wrote:> Hi all, > I follow the JNI rules to write Javawrapper for the liblustre code,A good rule to follow when trying to debug a problem is to reduce it to it''s simplest case. In your case that means stripping the problem of all of this Java and dealing with the basic problem which is:> ... > 1225417124.467324:6009:grid.scut.edu.cn:(class_obd.c: > 543:init_obdclass()): > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:543:init_obdclass()): OBD > class driver, http://www.lustre.org/ > 1225417124.467374:6009:grid.scut.edu.cn:(class_obd.c: > 544:init_obdclass()): > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:544:init_obdclass()): > Lustre > Version: 1.9.80 > 1225417124.467400:6009:grid.scut.edu.cn:(class_obd.c: > 545:init_obdclass()): > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:545:init_obdclass()): Build > Version: > 1.9.80-20081019111435-CHANGED-.usr.src.linux-2.6.18-92.1.10-2.6.18- > prep > Lustre mount failed: Invalid argumentSo why did the mount fail? Did you set the environment as required for liblustre? I notice you are using 1.9.80. This branch is still in development and it could be entirely possible that liblustre on that branch is simply not (yet) working. Have you tried to reproduce your problem with a stable, known-working release? If you really want to debug the problem with 1.9.80 you need to use more basic methods of calling liblustre and when, and only when you know that works, start layering your Java wrapper on top of it. Maybe lustre/tests/acceptance-small.sh and/or lustre/liblustre/tests/sanity.c can be of help there. b.
kcruci
2008-Nov-05 02:11 UTC
[Lustre-devel] java successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_().
I use the release version 1.6.5.1, and the programme still halt on"Lustre mount failed: Invalid argument". I write a test in c which call the function in liblustremkdir.so, and gcc it with liblustremkdir.so, the c test run successfully. After some tests, I make a bold assumption that the function "mount" was targeted to the system call instead of catching by libsysio when using JNI. After that, I add some print in the src code, the log and my print is same at the first half, the second half, c test run successfully, but java does not. Here is the java log: =======================================[root at ost JNItests]# java org.lustre.liblustre.test.MkDir begin to run Native method I am in libsysio/src/fs.c:_sysio_fssw_register _sysio_init has successfully runed I am in INIT_SYSIO*initialize libsysio & mount rootfs* block! I am in libsysio/src/fs.c:_sysio_fssw_register I am in liblustre/llite.c:lllib_init I am in libsysio/src/fs.c:_sysio_fssw_register liblustre/llite_lib.c:_sysio_lustre_init has RUNed! Lustre mount failed: Invalid argument [root at ost JNItests]# ==================================== Review the above print, both _sysio_lustre_init() and _sysio_init() has successfully runed, so that the "lustre" has registered to the libsysio. My question is: When using java, why the libsysio cannot catch the "mount", even the libsysio is runing and the "lustre" has registered to the libsysio.> [root at grid JNItests]# vim *org_lustre_liblustre_test_MkDir.c * > #include <jni.h> > #include "org_lustre_liblustre_test_MkDir.h" > > extern void __liblustre_setup_(void); > extern void __liblustre_cleanup_(void); > > JNIEXPORT void JNICALL > Java_org_lustre_liblustre_test_MkDir_init(JNIEnv > * env, jclass inclass) > { > __liblustre_setup_(); > printf("liblustre setup!!\n"); > __liblustre_cleanup_(); > return; > > } > > Here is my filelist: > > *org.lustre.liblustre.test.MkDir.java > org_lustre_liblustre_test_MkDir.h > org_lustre_liblustre_test_MkDir.c > liblustremkdir.so.1.0 > liblustremkdir.so > *liblustre.a > libcap.so.1.10 > libpthread-2.5.so > libz.so.1.2.3 >On Nov 4, 9:48?pm, "Brian J. Murrell" <Brian.Murr... at Sun.COM> wrote:> On Mon, 2008-11-03 at 05:39 -0800, kcruci wrote: > > Hi all, > > I follow the JNI rules to write Javawrapper for the liblustre code, > > A good rule to follow when trying to debug a problem is to reduce it to > it''s simplest case. ?In your case that means stripping the problem of > all of this Java and dealing with the basic problem which is: > > > > > ... > > 1225417124.467324:6009:grid.scut.edu.cn:(class_obd.c: > > 543:init_obdclass()): > > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:543:init_obdclass()): OBD > > class driver,http://www.lustre.org/ > > 1225417124.467374:6009:grid.scut.edu.cn:(class_obd.c: > > 544:init_obdclass()): > > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:544:init_obdclass()): > > Lustre > > Version: 1.9.80 > > 1225417124.467400:6009:grid.scut.edu.cn:(class_obd.c: > > 545:init_obdclass()): > > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:545:init_obdclass()): Build > > Version: > > 1.9.80-20081019111435-CHANGED-.usr.src.linux-2.6.18-92.1.10-2.6.18- > > prep > > Lustre mount failed: Invalid argument > > So why did the mount fail? ?Did you set the environment as required for > liblustre? ?I notice you are using 1.9.80. ?This branch is still in > development and it could be entirely possible that liblustre on that > branch is simply not (yet) working. ?Have you tried to reproduce your > problem with a stable, known-working release? > > If you really want to debug the problem with 1.9.80 you need to use more > basic methods of calling liblustre and when, and only when you know that > works, start layering your Java wrapper on top of it. ?Maybe > lustre/tests/acceptance-small.sh and/or lustre/liblustre/tests/sanity.c > can be of help there. > > b. > > _______________________________________________ > Lustre-devel mailing list > Lustre-de... at lists.lustre.orghttp://lists.lustre.org/mailman/listinfo/lustre-devel
kcruci
2008-Nov-05 03:01 UTC
[Lustre-devel] java successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_().
I check the system environment(LIBLUSTRE_MOUNT_TARGET) and redo it with the reseased version 1.6.5.1, but the programme still halt at "Lustre mount failed: Invalid argument ". I write a test in c which call the function in liblustremkdir.so, and gcc it with liblustremkdir.so, the c tests run seccessfuly. So I make a bold assumption that the function "mount" was target to system call instead of catching by libsysio. After that I add some print in source code, and the print is same between c and java tests at the first half, but java halt at "Lustre mount failed: Invalid argument " and c run successfully. Here is the Java logs: ===[root at ost JNItests]# java org.lustre.liblustre.test.MkDir begin to run Native method I am in libsysio/src/fs.c:_sysio_fssw_register _sysio_init has successfully runed I am in INIT_SYSIO*initialize libsysio & mount rootfs* block! I am in libsysio/src/fs.c:_sysio_fssw_register I am in liblustre/llite.c:lllib_init I am in libsysio/src/fs.c:_sysio_fssw_register liblustre/llite_lib.c:_sysio_lustre_init has RUNed! Lustre mount failed: Invalid argument [root at ost JNItests]# === As can be seen in the above log, the _sysio_init() and _sysio_lustre_init() has runed, so that the libsysio was inited and the "lustre" must be successfully registered to libsysio. So, my question is that why libsysio cannot catch the "mount" even the _sysio_init() and _sysio_lustre_init() has runed when using JNI. -- Thanks! Ya-Jian.Luan On Nov 4, 9:48?pm, "Brian J. Murrell" <Brian.Murr... at Sun.COM> wrote:> On Mon, 2008-11-03 at 05:39 -0800, kcruci wrote: > > Hi all, > > I follow the JNI rules to write Javawrapper for the liblustre code, > > A good rule to follow when trying to debug a problem is to reduce it to > it''s simplest case. ?In your case that means stripping the problem of > all of this Java and dealing with the basic problem which is: > > > > > ... > > 1225417124.467324:6009:grid.scut.edu.cn:(class_obd.c: > > 543:init_obdclass()): > > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:543:init_obdclass()): OBD > > class driver,http://www.lustre.org/ > > 1225417124.467374:6009:grid.scut.edu.cn:(class_obd.c: > > 544:init_obdclass()): > > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:544:init_obdclass()): > > Lustre > > Version: 1.9.80 > > 1225417124.467400:6009:grid.scut.edu.cn:(class_obd.c: > > 545:init_obdclass()): > > Lustre: 6009-grid.scut.edu.cn:(class_obd.c:545:init_obdclass()): Build > > Version: > > 1.9.80-20081019111435-CHANGED-.usr.src.linux-2.6.18-92.1.10-2.6.18- > > prep > > Lustre mount failed: Invalid argument > > So why did the mount fail? ?Did you set the environment as required for > liblustre? ?I notice you are using 1.9.80. ?This branch is still in > development and it could be entirely possible that liblustre on that > branch is simply not (yet) working. ?Have you tried to reproduce your > problem with a stable, known-working release? > > If you really want to debug the problem with 1.9.80 you need to use more > basic methods of calling liblustre and when, and only when you know that > works, start layering your Java wrapper on top of it. ?Maybe > lustre/tests/acceptance-small.sh and/or lustre/liblustre/tests/sanity.c > can be of help there. > > b. > > _______________________________________________ > Lustre-devel mailing list > Lustre-de... at lists.lustre.orghttp://lists.lustre.org/mailman/listinfo/lustre-devel
Brian J. Murrell
2008-Nov-05 19:58 UTC
[Lustre-devel] java successfully call the Native functions, :-) but there are still some problems like "Lustre mount failed: Invalid argument", when i call the __liblustre_setup_().
On Tue, 2008-11-04 at 19:01 -0800, kcruci wrote:> > I write a test in c which call the function in liblustremkdir.so, and > gcc it with liblustremkdir.so, the c tests run seccessfuly.Ahhh. Good.> So, my question is that why libsysio cannot catch the "mount" even the > _sysio_init() and _sysio_lustre_init() has runed when using JNI.Sorry, I have no idea. I know nothing at all about developing in Java. Sounds like this is more a Java question than a Lustre question though. Maybe there is a different audience you can target that would know more about Java and external libraries than you will probably find here. b. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part Url : http://lists.lustre.org/pipermail/lustre-devel/attachments/20081105/b17f06a6/attachment.bin