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

huangapple go评论102阅读模式
英文:

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

问题

以下是您提供的代码的翻译部分:

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

#=====================
# 程序从这里开始
#=====================
if __name__ == "__main__":
    print "在主函数中"
    print len(sys.argv)
    if len(sys.argv) < 2:
        print '参数不足'
        System.exit(-1)
    else:
        try:
            print "尝试中 - JASON"
            print (os.getcwd())
            fileHandler = FileHandler("weblogic.log", 1)
            print "尝试中 2"
            fileHandler.setFormatter(SimpleFormatter())

您提供的堆栈跟踪如下:

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

由于您要求只返回翻译好的部分,上述内容是按照您的要求翻译的代码和堆栈跟踪。如果您有任何进一步的问题或需要解决方案,请随时提问。

英文:

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__ == &quot;__main__&quot;:
    print &quot;in main&quot;
    print len(sys.argv)
    if len(sys.argv) &lt; 2:
                print &#39;Insufficent arguments&#39;
                System.exit(-1)
    else:
        try:
            print &quot;inside try - JASON&quot;
            print (os.getcwd())
            fileHandler = FileHandler(&quot;weblogic.log&quot;,1);
            print &quot;inside try 2&quot;
            fileHandler.setFormatter(SimpleFormatter());`

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

Stack trace :

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

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

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

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

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

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

&quot;Finalizer&quot; 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 &lt;0x73a28788&gt; (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:152)
	- locked &lt;0x73a28788&gt; (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)

&quot;Reference Handler&quot; 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 &lt;0x73a28818&gt; (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 &lt;0x73a28818&gt; (a java.lang.ref.Reference$Lock)

&quot;main&quot; 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 &lt;0x710b6228&gt; (a java.util.HashMap)
	at java.util.logging.FileHandler.&lt;init&gt;(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)

&quot;VM Thread&quot; prio=8 tid=0x00640400 nid=5 lwp_id=3559257 runnable 

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

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

&quot;VM Periodic Task Thread&quot; 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.

答案1

得分: 0

这个问题在将日志文件的位置从/SHARED更改为本地后得以解决。

旧的:

 fileHandler = FileHandler(&quot;/SHARED/weblogic.log&quot;,1);
                print &quot;尝试内部 2&quot;
                fileHandler.setFormatter(SimpleFormatter());`

新的:

 fileHandler = FileHandler(&quot;/home/user/weblogic.log&quot;,1);
            print &quot;尝试内部 2&quot;
            fileHandler.setFormatter(SimpleFormatter());`

文件系统方面,写入文件时在/shared文件系统中存在一些问题,这就是为什么它被卡住的原因。

英文:

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

OLD :

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

NEW :

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

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

huangapple
  • 本文由 发表于 2020年9月6日 22:37:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/63765313.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定