Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Aug 2011 14:37:04 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        bf1783@gmail.com
Cc:        glewis@freebsd.org, tinderbox-list@marcuscom.com, des@freebsd.org, freebsd-java@freebsd.org
Subject:   Re: java + procfs + nullfs = disaster
Message-ID:  <20110812113704.GO17489@deviant.kiev.zoral.com.ua>
In-Reply-To: <CAGFTUwNUM2zb77UVZT3YDo-AdfokKviMihERD3x3_6KGHKVnEQ@mail.gmail.com>
References:  <CAGFTUwNUM2zb77UVZT3YDo-AdfokKviMihERD3x3_6KGHKVnEQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--TIpgJVE/z+6z946i
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Aug 11, 2011 at 03:18:38PM -0400, b. f. wrote:
> I've run into a problem building java ports on my FreeBSD 9 amd64
> tinderbox.  Following an earlier suggestion,
>=20
> http://www.marcuscom.com/pipermail/tinderbox-list/2010-September/001957.h=
tml
>=20
> I've been performing builds in a tmpfs that is nullfs-mounted on a ufs
> mountpoint.  After building packages for java/diablo-jdk16 on
> {7.3,8.1}-{i386,amd64}, the ports that depend upon it fail when
> invoking java binary executables from that port, with:
>=20
> Error: could not find libjava.so
> Error: could not find Java 2 Runtime Environment.
>=20
> A search of the mailing lists reveals that this problem has occurred
> for the past several years, and has sometimes been attributed to the
> fact that a procfs is mounted on /proc, and sometimes to vague nullfs
> problems, but has never been solved:
>=20
> http://lists.freebsd.org/pipermail/freebsd-java/2011-March/009169.html
> http://lists.freebsd.org/pipermail/freebsd-stable/2010-May/056814.html
> http://lists.freebsd.org/pipermail/freebsd-java/2009-May/008104.html
> http://lists.freebsd.org/pipermail/freebsd-java/2009-February/007854.html
> http://lists.freebsd.org/pipermail/freebsd-stable/2005-February/011629.ht=
ml
> ...
>=20
> However, it seems rather to be a combination of factors, because, for
> example, if I:
>=20
> mount /proc
> mkdir /tmp/java
> tar -C /tmp/java -xvf
> /home/shared/freebsd/tinderbox/packages/8.1-amd64-u1/All/diablo-jdk-1.6.0=
.07.02_15.tbz
> cd /tmp/diablo-jdk1.6.0/bin
> truss ./java -version
>=20
> , I obtain:
>=20
> ...
>=20
> readlink("/proc/curproc/file","/tmp/java/diablo-jdk1.6.0/bin/java",1024)
> =3D 35 (0x23)
> access("/tmp/java/diablo-jdk1.6.0/lib/amd64/libjava.so",0) ERR#2 'No
> such file or directory'
> access("/tmp/java/diablo-jdk1.6.0/jre/lib/amd64/libjava.so",0) =3D 0 (0x0)
>=20
> ...
>=20
> , and libjava.so is found.  Then, if I:
>=20
>  umount /proc
> truss ./java -version
>=20
> , the library is also found, in a slightly different manner:
>=20
> +readlink("/proc/curproc/file",0x7fffffffca40,1024) ERR#2 'No such
> file or directory'
> +__getcwd("/tmp/java/diablo-jdk1.6.0/bin",1026)   =3D 0 (0x0)
> +stat("/tmp/java/diablo-jdk1.6.0/bin/./java",{ mode=3D-rwxr-xr-x
> ,inode=3D3121,size=3D95014,blksize=3D4096 }) =3D 0 (0x0)
> +lstat("/tmp",{ mode=3Ddrwxrwxrwt ,inode=3D2,size=3D600,blksize=3D4096 })=
 =3D 0 (0x0)
> +lstat("/tmp/java",{ mode=3Ddrwxr-xr-x ,inode=3D15,size=3D280,blksize=3D4=
096
> }) =3D 0 (0x0)
> +lstat("/tmp/java/diablo-jdk1.6.0",{ mode=3Ddrwxr-xr-x
> ,inode=3D3105,size=3D560,blksize=3D4096 }) =3D 0 (0x0)
> +lstat("/tmp/java/diablo-jdk1.6.0/bin",{ mode=3Ddrwxr-xr-x
> ,inode=3D3112,size=3D1720,blksize=3D4096 }) =3D 0 (0x0)
> +lstat("/tmp/java/diablo-jdk1.6.0/bin/java",{ mode=3D-rwxr-xr-x
> ,inode=3D3121,size=3D95014,blksize=3D4096 }) =3D 0 (0x0)
>  access("/tmp/java/diablo-jdk1.6.0/lib/amd64/libjava.so",0) ERR#2 'No
> such file or directory'
>  access("/tmp/java/diablo-jdk1.6.0/jre/lib/amd64/libjava.so",0) =3D 0 (0x=
0)
>=20
>=20
> However, if I:
>=20
> rm -vr /tmp/java
> mount /proc
> mkdir /tmp/java /root/java
> mount -t nullfs /tmp/java /root/java
> tar -C /root/java -xvf
> /home/shared/freebsd/tinderbox/packages/8.1-amd64-u1/All/diablo-jdk-1.6.0=
.07.02_15.tbz
> cd /root/diablo-jdk1.6.0/bin
> truss ./java -version
>=20
> then the library cannot be found:
>=20
> readlink("/proc/curproc/file","unknown",1024)    =3D 7 (0x7)
> Error: could not find libjava.so
> write(2,"Error: could not find libjava.so"...,33) =3D 33 (0x21)
> Error: could not find Java 2 Runtime Environment.
> write(2,"Error: could not find Java 2 Run"...,50) =3D 50 (0x32)
This is a long-standing strangeness in our procfs. I wonder how much
will break after the following. Can you try ls -l /proc/<pid>/
in the situation when file previously shown 'unknown' ?

diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c
index 8b69eb1..514e279 100644
--- a/sys/fs/procfs/procfs.c
+++ b/sys/fs/procfs/procfs.c
@@ -67,20 +67,23 @@
 int
 procfs_doprocfile(PFS_FILL_ARGS)
 {
-	char *fullpath =3D "unknown";
-	char *freepath =3D NULL;
+	char *fullpath;
+	char *freepath;
 	struct vnode *textvp;
+	int error;
=20
+	freepath =3D NULL;
 	PROC_LOCK(p);
 	textvp =3D p->p_textvp;
 	vhold(textvp);
 	PROC_UNLOCK(p);
-	vn_fullpath(td, textvp, &fullpath, &freepath);
+	error =3D vn_fullpath(td, textvp, &fullpath, &freepath);
 	vdrop(textvp);
-	sbuf_printf(sb, "%s", fullpath);
-	if (freepath)
+	if (error =3D=3D 0)
+		sbuf_printf(sb, "%s", fullpath);
+	if (freepath !=3D NULL)
 		free(freepath, M_TEMP);
-	return (0);
+	return (error);
 }
=20
 /*

--TIpgJVE/z+6z946i
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAk5FEF8ACgkQC3+MBN1Mb4g7EwCfZTd4P7AOIod3yU9HkmLczMuh
ongAoKi86yVAdEVzEpR0T11YDHKb0uOu
=ZkGy
-----END PGP SIGNATURE-----

--TIpgJVE/z+6z946i--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110812113704.GO17489>