liu0013
liu0013
2009-06-17 16:56
浏览 244
已采纳

io locked, ifxjdbc.jar 是否存在bug

一个数据入库的线程,偶尔会出现如下问题,导致入库的线程阻塞住了。不知道是不是属于jdbc的bug,有什么好的解决办法么?
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
- locked (a java.io.BufferedInputStream)
at com.informix.asf.IfxDataInputStream.readFully(IfxDataInputStream.java:149)
at com.informix.asf.IfxDataInputStream.readInt(IfxDataInputStream.java:229)
at com.informix.jdbc.IfxSqli.receiveCost(IfxSqli.java:2874)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2259)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2174)
at com.informix.jdbc.IfxSqli.sendExecute(IfxSqli.java:1230)
at com.informix.jdbc.IfxSqli.sendCommand(IfxSqli.java:812)
at com.informix.jdbc.IfxSqli.executeCommand(IfxSqli.java:697)
at com.informix.jdbc.IfxResultSet.executeUpdate(IfxResultSet.java:305)
at com.informix.jdbc.IfxStatement.executeUpdateImpl(IfxStatement.java:850)
at com.informix.jdbc.IfxPreparedStatement.executeBatch(IfxPreparedStatement.java:3072)

[b]问题补充:[/b]
是用jstack 查看的信息,线程并未抛出异常:
"Thread-3421" prio=10 tid=0x00002aaafc0a7000 nid=0x6df0 runnable [0x0000000042dd5000..0x0000000042dd5a10]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
- locked (a java.io.BufferedInputStream)
at com.informix.asf.IfxDataInputStream.readFully(IfxDataInputStream.java:149)
at com.informix.asf.IfxDataInputStream.readInt(IfxDataInputStream.java:229)
at com.informix.jdbc.IfxSqli.receiveCost(IfxSqli.java:2874)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2259)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2174)
at com.informix.jdbc.IfxSqli.sendExecute(IfxSqli.java:1230)
at com.informix.jdbc.IfxSqli.sendCommand(IfxSqli.java:812)
at com.informix.jdbc.IfxSqli.executeCommand(IfxSqli.java:697)
at com.informix.jdbc.IfxResultSet.executeUpdate(IfxResultSet.java:305)
at com.informix.jdbc.IfxStatement.executeUpdateImpl(IfxStatement.java:850)
at com.informix.jdbc.IfxPreparedStatement.executeBatch(IfxPreparedStatement.java:3072)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at com.ebupt.pa.zmcc.sxdatasynch.adgroup.InsertGroupThread.run(InsertGroupThread.java:55)
[b]问题补充:[/b]
我的多线程逻辑很简单,只是有个线程池,把数据从文件里取出一部分,从线程池中取出一个线程入库。
如果真的是jdbc的bug,有什么方法来打断这个阻塞呢?
另外能具体说下

  • locked (a java.io.BufferedInputStream)

这个问题的原因,是什么情况会出现io locked呢?“同步操作”具体一点?不太明白,谢谢!
[b]问题补充:[/b]
从线程堆栈看,有时只有一个线程阻塞,应该不是得不到资源导致线程死锁的,
另外我想有没有可能是socket链路出了问题,导致缓冲区满了,而使read()方法locked了呢?不清晰的想法,有点模糊。
[b]问题补充:[/b]
恩,大概间隔一些天才会出现一次,是否有什么办法来弥补一下这个bug,比如发现某个线程阻塞了,用什么方法结束线程,再重新启动一个线程呢?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

5条回答 默认 最新

  • wanghaolovezlq
    wanghaolovezlq 2009-06-17 17:58
    已采纳
        - locked <0x00002aaab3c84eb8> (a java.io.BufferedInputStream) 
    

    会不会由于什么原因同步操作时搞出问题了

    如果你代码写得没问题,那可能真是它的bug,

    看看你的代码对于多线程的情况

    点赞 评论
  • wanghaolovezlq
    wanghaolovezlq 2009-06-17 17:20

    异常信息没粘全吧

    点赞 评论
  • wanghaolovezlq
    wanghaolovezlq 2009-06-18 10:20

    就是多个线程同时竞争相同的资源,比如io操作,互相之间保持了对方想要的资源锁,双方都不释放锁,导致两个线程死锁了

    点赞 评论
  • wanghaolovezlq
    wanghaolovezlq 2009-06-18 12:32

    这样看也定位不出什么具体的原因,

    时好时错的

    点赞 评论
  • wanghaolovezlq
    wanghaolovezlq 2009-06-29 08:10

    朋友,问题要自动关闭啦,结分哦

    点赞 评论

相关推荐