manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Wright (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONNECTORS-1101) ^C of single-process example sometimes hangs under MySQL
Date Fri, 14 Nov 2014 02:00:36 GMT

    [ https://issues.apache.org/jira/browse/CONNECTORS-1101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14211701#comment-14211701
] 

Karl Wright commented on CONNECTORS-1101:
-----------------------------------------

This code is causing the hang:

{code}
    ExecuteQueryThread t = new ExecuteQueryThread(connection,query,params,bResults,maxResults,spec,returnLimit);
    try
    {
      t.start();
      return t.finishUp();
    }
    catch (InterruptedException e)
    {
      // Try to kill the background thread - but we can't wait for it...
      t.interrupt();
      // VERY IMPORTANT: Try to close the connection, so nothing is left dangling.  The connection
will be abandoned anyhow.
      try
      {
        if (!connection.getAutoCommit())
          connection.rollback();
        connection.close();
      }
      catch (Exception e2)
      {
      }
      // We need the caller to abandon any connections left around, so rethrow in a way that
forces them to process the event properly.
      throw new ManifoldCFException(e.getMessage(),e,ManifoldCFException.INTERRUPTED);
    }
{code}

As can be seen, I believe that the close is there to avoid locking up resources which may
otherwise persist during the shutdown.  Clearly there was an issue in this code once before,
which was resolved by attempting to close the connection.  But this flow is inappropriate
for MySQL because of the hang issue.


> ^C of single-process example sometimes hangs under MySQL
> --------------------------------------------------------
>
>                 Key: CONNECTORS-1101
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-1101
>             Project: ManifoldCF
>          Issue Type: Bug
>          Components: Framework agents process
>    Affects Versions: ManifoldCF 1.8
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>             Fix For: ManifoldCF 1.8, ManifoldCF 2.0
>
>
> A ^C of the agents process using the MySQL database driver hung and had the following
in its thread dump:
> {code}
> "Thread-34778" daemon prio=6 tid=0x00000000152f2000 nid=0x2d18 waiting for monitor entry
[0x000000000b92e000]
>    java.lang.Thread.State: BLOCKED (on object monitor)
> 	at com.mysql.jdbc.ConnectionImpl.getCharacterSetMetadata(ConnectionImpl.java:2798)
> 	- waiting to lock <0x00000000f0610a20> (a com.mysql.jdbc.JDBC4Connection)
> 	at com.mysql.jdbc.Field.getStringFromBytes(Field.java:710)
> 	at com.mysql.jdbc.Field.getTableName(Field.java:781)
> 	at com.mysql.jdbc.Field.getFullName(Field.java:545)
> 	at com.mysql.jdbc.ResultSetImpl.buildIndexMapping(ResultSetImpl.java:751)
> 	at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1108)
> 	- locked <0x00000000fb82ba28> (a com.mysql.jdbc.JDBC4ResultSet)
> 	at org.apache.manifoldcf.core.database.Database.findColumn(Database.java:1128)
> 	at org.apache.manifoldcf.core.database.Database.getData(Database.java:976)
> 	at org.apache.manifoldcf.core.database.Database.execute(Database.java:884)
> 	at org.apache.manifoldcf.core.database.Database$ExecuteQueryThread.run(Database.java:683)
> "Worker thread '32'" daemon prio=6 tid=0x0000000009dce000 nid=0x2f68 waiting for monitor
entry [0x000000000fb8e000]
>    java.lang.Thread.State: BLOCKED (on object monitor)
> 	at com.mysql.jdbc.ResultSetImpl.realClose(ResultSetImpl.java:7477)
> 	- waiting to lock <0x00000000fb82ba28> (a com.mysql.jdbc.JDBC4ResultSet)
> 	at com.mysql.jdbc.ResultSetImpl.close(ResultSetImpl.java:907)
> 	at com.mysql.jdbc.StatementImpl.realClose(StatementImpl.java:2478)
> 	- locked <0x00000000f10d7c60> (a com.mysql.jdbc.JDBC4PreparedStatement)
> 	at com.mysql.jdbc.PreparedStatement.realClose(PreparedStatement.java:3091)
> 	- locked <0x00000000f10d7c60> (a com.mysql.jdbc.JDBC4PreparedStatement)
> 	at com.mysql.jdbc.ConnectionImpl.closeAllOpenStatements(ConnectionImpl.java:1584)
> 	at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4364)
> 	at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1556)
> 	- locked <0x00000000f0610a20> (a com.mysql.jdbc.JDBC4Connection)
> 	at org.apache.manifoldcf.core.database.Database.executeViaThread(Database.java:739)
> 	at org.apache.manifoldcf.core.database.Database.executeUncachedQuery(Database.java:762)
> 	at org.apache.manifoldcf.core.database.Database$QueryCacheExecutor.create(Database.java:1435)
> 	at org.apache.manifoldcf.core.cachemanager.CacheManager.findObjectsAndExecute(CacheManager.java:146)
> 	at org.apache.manifoldcf.core.database.Database.executeQuery(Database.java:191)
> 	at org.apache.manifoldcf.core.database.DBInterfaceMySQL.performQuery(DBInterfaceMySQL.java:875)
> 	at org.apache.manifoldcf.core.database.BaseTable.performQuery(BaseTable.java:221)
> 	at org.apache.manifoldcf.crawler.jobs.HopDeleteDeps.getDeleteDependencies(HopDeleteDeps.java:191)
> 	at org.apache.manifoldcf.crawler.jobs.HopCount.doRecord(HopCount.java:470)
> 	at org.apache.manifoldcf.crawler.jobs.HopCount.recordReferences(HopCount.java:361)
> 	at org.apache.manifoldcf.crawler.jobs.JobManager.addDocuments(JobManager.java:5057)
> 	at org.apache.manifoldcf.crawler.system.WorkerThread$ProcessActivity.processDocumentReferences(WorkerThread.java:1966)
> 	at org.apache.manifoldcf.crawler.system.WorkerThread$ProcessActivity.flush(WorkerThread.java:1909)
> 	at org.apache.manifoldcf.crawler.system.WorkerThread.run(WorkerThread.java:427)
> {code}
> It looks like the database handle close hung waiting for a mysql operation to finish
up, which was in turn probably disrupted by a Thread.interrupt().



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message