Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error reporting when j9shmem_getDir() failed. #5151

Merged
merged 1 commit into from
Mar 21, 2019

Conversation

hangshao0
Copy link
Contributor

  1. Change j9shmem_getDir() to return different error code for different
    failures.
  2. Change the caller of j9shmem_getDir()to print new NLS messages
    according to the error code returned from j9shmem_getDir().
  3. Update the test code to check if j9shmem_getDir() returns a negative
    value instead of -1.

Fixes #5134

Signed-off-by: Hang Shao hangshao@ca.ibm.com

@hangshao0
Copy link
Contributor Author

hangshao0 commented Mar 19, 2019

Manually set HOME to NFS:

java -Xshareclasses:name=Cache1 -version
JVMSHRC831E Failed to use user's home as the default shared cache directory. It is on a Network File System. Please set another directory via environment variable "HOME" or fix the home directory in the password file entry.
JVMSHRC831E Failed to use user's home as the default shared cache directory. It is on a Network File System. Please set another directory via environment variable "HOME" or fix the home directory in the password file entry.
JVMJ9VM015W Initialization error for library j9shr29(11): JVMJ9VM009E J9VMDllMain failed
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

java -Xshareclasses:name=Cache1,silent -version
JVMJ9VM015W Initialization error for library j9shr29(11): JVMJ9VM009E J9VMDllMain failed
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

java -Xshareclasses:name=Cache1,nonfatal -version
JVMSHRC831E Failed to use user's home as the default shared cache directory. It is on a Network File System. Please set another directory via environment variable "HOME" or fix the home directory in the password file entry.
JVMSHRC831E Failed to use user's home as the default shared cache directory. It is on a Network File System. Please set another directory via environment variable "HOME" or fix the home directory in the password file entry.
JVMSHRC686I Failed to startup shared class cache. Continue without using it as -Xshareclasses:nonfatal is specified
openjdk version "1.8.0_202-internal"
OpenJDK Runtime Environment (build 1.8.0_202-internal-jenkins_2019_03_18_14_23-b00)
Eclipse OpenJ9 VM (build FixSCC-a41867c5f, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20190318_863 (JIT enabled, AOT enabled)
OpenJ9   - 9f1746bad
OMR      - 9b73e2bd
JCL      - 6894a182ad1 based on jdk8u202-b08)

The reason JVMSHRC831E shows up twice is because we try getting the cache dir both in checkIfCacheExists() and SH_OSCache::commonStartup(). Without this change, there were also 2 NLS messages printed out in checkIfCacheExists() and SH_OSCache::commonStartup().

@pshipton
Copy link
Member

Is it much work to fix the error to only print once?

1. Change j9shmem_getDir() to return different error code for different
failures.
2. Change the caller of j9shmem_getDir()to print new NLS messages
according to the error code returned from j9shmem_getDir().
3. Update the test code to check if j9shmem_getDir() returns a negative
value instead of -1.

Fixes eclipse-openj9#5134

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
@hangshao0
Copy link
Contributor Author

Is it much work to fix the error to only print once?

We need to change the signature of SH_OSCache::getCacheDir() to control whether the NLS messages should be printed. There are about 20 callers.

@pshipton
Copy link
Member

jenkins test sanity win,plinux jdk11

@pshipton
Copy link
Member

We need to change the signature of SH_OSCache::getCacheDir() to control whether the NLS messages should be printed. There are about 20 callers.

Seems better done separately.

@pshipton pshipton merged commit 698eb8b into eclipse-openj9:master Mar 21, 2019
#if !defined(WIN32) && !defined(WIN64)
/* Get platform default cache directory */
rc = j9shmem_getDir(NULL, J9SHMEM_GETDIR_APPEND_BASEDIR, defaultCacheDir, J9SH_MAXPATH);
if (-1 == rc) {
if (-1 == j9shr_getCacheDir(vm, NULL, defaultCacheDir, J9SH_MAXPATH, vm->sharedCacheAPI->cacheType)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will always be false.

  • @internal J9PORT_ERROR_SHMEM* range from at -170 to -199 to match hyporterror.h codes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is intentional? If it did happen we'd hit the assert.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

j9shr_getCacheDir() and SH_OSCache::getCacheDir() returns -1 on failure. I think the assert needs to be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this assert in the next PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR: #5202

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I thought it was still using j9shmem_getDir(). I need to learn to read more carefully.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You found a problem anyway :)

hangshao0 added a commit to hangshao0/openj9 that referenced this pull request Apr 1, 2019
Add a new input parameter "allowVerbose" to SH_OSCache::getCacheDir()
Always call SH_OSCache::getCacheDir() with allowVerbose = false in
j9shr_getCacheDir().

related to eclipse-openj9#5134 and eclipse-openj9#5151

Signed-off-by: Hang Shao <hangshao@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Having a NFS home directory gives confusing shared cache error message
3 participants