javamultithreadingweblogic12cjython-2.7

java.lang.Thread.State: WAITING (on object monitor)


I am trying to create weblogic domain using python code which got stuck at filehandler and below is code and stacktrace which is waiting on something can you help to fix it ?

import os
import sys
import wl as myWLST

from java.lang import System,Runtime,Process,String
from java.io import BufferedReader,InputStreamReader,File
from java.util.logging import FileHandler,Logger,SimpleFormatter

from com.oracle.cie.domain.script.jython import WLSTException
from com.oracle.cie.domain.script import ScriptException
from WeblogicConfigXmlParser import XmlParser

#=====================
# Program starts here
#=====================
if __name__ == "__main__":
    print "in main"
    print len(sys.argv)
    if len(sys.argv) < 2:
                print 'Insufficent arguments'
                System.exit(-1)
    else:
        try:
            print "inside try - JASON"
            print (os.getcwd())
            fileHandler = FileHandler("weblogic.log",1);
            print "inside try 2"
            fileHandler.setFormatter(SimpleFormatter());`

it is stuck at line "fileHandler = FileHandler("weblogic.log",1);",

Stack trace :

Full thread dump Java HotSpot(TM) Server VM (24.255-b255-jre1.7.0.25.ia-rc1 mixed mode):

"Attach Listener" daemon prio=8 tid=0x00835000 nid=13 lwp_id=3559300 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Service Thread" daemon prio=8 tid=0x00676c00 nid=12 lwp_id=3559264 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread1" daemon prio=8 tid=0x00670600 nid=10 lwp_id=3559262 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"C2 CompilerThread0" daemon prio=8 tid=0x0066ce00 nid=9 lwp_id=3559261 waiting on condition [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Signal Dispatcher" daemon prio=8 tid=0x0066aa00 nid=8 lwp_id=3559260 runnable [0x00000000]
   java.lang.Thread.State: RUNNABLE

"Finalizer" daemon prio=8 tid=0x00653a00 nid=7 lwp_id=3559259 in Object.wait() [0x484c0000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x73a28788> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:152)
    - locked <0x73a28788> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:168)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:248)

"Reference Handler" daemon prio=8 tid=0x00651600 nid=6 lwp_id=3559258 in Object.wait() [0x4a3c0000]
   java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x73a28818> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:503)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:140)
    - locked <0x73a28818> (a java.lang.ref.Reference$Lock)

"main" prio=8 tid=0x00473400 nid=1 lwp_id=-1 runnable [0x7fffd000]
   java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)
    at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:90)
    at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1098)
    at java.nio.channels.FileChannel.tryLock(FileChannel.java:1154)
    at java.util.logging.FileHandler.openFiles(FileHandler.java:438)
    - locked <0x710b6228> (a java.util.HashMap)
    at java.util.logging.FileHandler.<init>(FileHandler.java:310)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.python.core.PyReflectedConstructor.__call__(Unknown Source)
    at org.python.core.PyJavaInstance.__init__(Unknown Source)
    at org.python.core.PyJavaClass.__call__(Unknown Source)
    at org.python.core.PyObject.__call__(Unknown Source)
    at org.python.pycode._pyx0.f$0(/SHARED/scripts/weblogicscripts/WeblogicDomainManager.py:428)
    at org.python.pycode._pyx0.call_function(/SHARED/scripts/weblogicscripts/WeblogicDomainManager.py)
    at org.python.core.PyTableCode.call(Unknown Source)
    at org.python.core.PyCode.call(Unknown Source)
    at org.python.core.Py.runCode(Unknown Source)
    at org.python.core.__builtin__.execfile_flags(Unknown Source)
    at org.python.util.PythonInterpreter.execfile(Unknown Source)
    at org.python.util.jython.main(Unknown Source)

"VM Thread" prio=8 tid=0x00640400 nid=5 lwp_id=3559257 runnable 

"GC task thread#0 (ParallelGC)" prio=8 tid=0x00495000 nid=3 lwp_id=3559255 runnable 

"GC task thread#1 (ParallelGC)" prio=8 tid=0x004bb600 nid=4 lwp_id=3559256 runnable 

"VM Periodic Task Thread" prio=8 tid=0x00674800 nid=11 lwp_id=3559263 waiting on condition 

JNI global references: 273

Not able to figure why it is stuck at filehandler, it is creating any weblogic.log either and not getting timedout. even i used "-XX:CompileCommand="exclude,java/lang/Object.wait" based on this post object waiting but still no luck.


Solution

  • This is solved after changing the location of the log file from /SHARED to local

    OLD :

     fileHandler = FileHandler("/SHARED/weblogic.log",1);
                    print "inside try 2"
                    fileHandler.setFormatter(SimpleFormatter());`
    

    NEW :

     fileHandler = FileHandler("/home/user/weblogic.log",1);
                print "inside try 2"
                fileHandler.setFormatter(SimpleFormatter());`
    

    filesystem, there is some issue with /shared file system while writing files, which is why it is stuck.