Date: Sun, 2 Jun 2013 08:16:58 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: ????????? <huanghwh@yahoo.com> Cc: "java@freebsd.org" <java@freebsd.org> Subject: Re: System.currentTimeMillis() is totally wrong after call JNA mlockall Message-ID: <20130602051658.GZ3047@kib.kiev.ua> In-Reply-To: <1370140389.34142.YahooMailNeo@web15306.mail.cnb.yahoo.com> References: <1370140389.34142.YahooMailNeo@web15306.mail.cnb.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--u0iPJxgGkE/yllRJ Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 02, 2013 at 10:33:09AM +0800, ????????? wrote: > Hi, > I recently found that Cassandra 1.2.4 could not shutdown when enable JNA, > so I try to solve it, and found that under OpenJDK6/FreeBSD,=9A > System.currentTimeMillis() is totally wrong after call JNA mlockall, > time seams to not change anymore. You did not specified the version of the system. I assume this is either 9-STABLE or HEAD ? Also, I believe you use TSC as timecounter, check with the sysctl kern.timecounter.hardware. Try the patch below. I also added the C program that should exhibit the same behaviour of reporting the stale time. diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 3890157..c45b974 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1050,8 +1050,9 @@ exec_new_vmspace(imgp, sv) vm_object_reference(obj); error =3D vm_map_fixed(map, obj, 0, sv->sv_shared_page_base, sv->sv_shared_page_len, - VM_PROT_READ | VM_PROT_EXECUTE, VM_PROT_ALL, - MAP_COPY_ON_WRITE | MAP_ACC_NO_CHARGE); + VM_PROT_READ | VM_PROT_EXECUTE, + VM_PROT_READ | VM_PROT_EXECUTE, + MAP_INHERIT_SHARE | MAP_ACC_NO_CHARGE); if (error) { vm_object_deallocate(obj); return (error); /* $Id: time_mlock.c,v 1.4 2013/06/02 05:15:53 kostik Exp kostik $ */ #include <sys/types.h> #include <sys/mman.h> #include <sys/wait.h> #include <err.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> int main(void) { time_t t; pid_t child; if (mlockall(MCL_CURRENT | MCL_FUTURE) =3D=3D -1) err(1, "mlockall"); fflush(stdout); child =3D fork(); if (child =3D=3D -1) { err(1, "fork"); } else if (child =3D=3D 0) { time(&t); printf("%s", ctime(&t)); sleep(3); time(&t); printf("%s", ctime(&t)); } return (0); } --u0iPJxgGkE/yllRJ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJRqtVJAAoJEJDCuSvBvK1BNPQP/A/XWJAlxZsSyTjpR8EoiAZ4 nEXHGZDreMTbuHSGMzbBot3j+x60q1Fg13f5IkqG2zCEEvuRsi4QwbRChIdzGdEj 3dGQSj4UFCkTAwKKCXCnZQoc3DZMfz0CQ1UczSAeH4rldNu4y1cjz/nXkwCc5dVY S2CBqYdqQO6kfcOSm6ocvdEGYKbadvZBE1tEHr+b0Rq9AMlz4FTNdZ/l5Gbckb/A MIBBQuLkvhhlDNHZ7s8pTg7q8NX9llcUm4sp1UswEjMowAQzZg2ntrCtnmWiiiHD PyneefjrfI4UTk611Ta2N1Hn94gRoxekgvoumz5qWaOIWu3/mp2Q2UKEnvBXeVjH lhG24TIE2seDSIcm0FqygJy2vyoV2QIFmp0fOqBK04dXmM+DNt6opegq6fuBSa7L T+Vwf6xsgwtLOYjWu0BFAAlEE4r7dX0glIw9q0iDBW11DxyK4dnAw4b1C0nM9aqf dNngMXAD9u6l7qNFvcEDwqCDR43mUxPGB96la5QahXsyvlOIClng7p1yvjSS38ML WT91g/3yl9FH5fG+YcbvPUoBNy6Ffs4CeLwnjKWpVUACw/vl4xuP+7tHLvVnZTZ3 88TSgoVaW4+jOCMxBqnZaMxGbTG7k8K9ZHX+BH6ffHKkCnbM9/Itq6jNB333l0Gu Xuj2S2UuDPV3pL4ZFs82 =OCt5 -----END PGP SIGNATURE----- --u0iPJxgGkE/yllRJ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130602051658.GZ3047>