[CONJ-1073] 3.0.5 -> 3.0.6 causing batch updates to hang indefinitely Created: 2023-05-01  Updated: 2023-06-07

Status: Open
Project: MariaDB Connector/J
Component/s: None
Affects Version/s: 3.0.6
Fix Version/s: None

Type: Bug Priority: Major
Reporter: John Cover Assignee: Diego Dupin
Resolution: Unresolved Votes: 0
Labels: None
Environment:

JDK:

  • Java 11

Database Server:

  • AWS 5.7.mysql_aurora.2.10.3

Other Possibly Relevant Artifacts:

  • javax.persistence-api version 2.2
  • eclipselink version 2.5.2
  • org.eclipse.persistence.jpa.modelgen.processor version 2.5.2


 Description   

I'm struggling to resolve a bug that was introduced when updating mariadb-java-client from 3.0.4 to 3.0.5 and exists still in the latest 3.1.3 version.

The following code snippet will hang without ever actually generating any SQL logging via Eclipse Link's logging mechanisms:

    public void batchUpdate(List<ContactListEntity> contactList) throws SQLException {
        EntityManager em = null;
 
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            int i = 0;
 
            for (ContactListEntity c : contactList) {
                em.merge(c);
                if (i % 500 == 0) {
                    em.flush();
                    em.clear();
                }
                i++;
            }
            em.getTransaction().commit();
        } catch (Exception e) {
            e.printStackTrace();
            if (em != null) em.getTransaction().rollback();
            throw new SQLException(e.getMessage());
        } finally {
            if (em != null) {
                em.close();
            }
        }
    }

Here's the current persistence configuration file utilized by EclipseLink in case it's helpful:

        <properties>
            <property name="javax.persistence.jdbc.driver" value="org.mariadb.jdbc.Driver"/>
            <property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
            <property name="eclipselink.jdbc.batch-writing.size" value="500"/>
            <property name="eclipselink.jdbc.bind-parameters" value="TRUE"/>
        </properties>

Reverting to 3.0.5 resolves the issue.



 Comments   
Comment by Diego Dupin [ 2023-06-07 ]

I've tryed to reproduced that problem without success.

I suspect that problem reside in aurora that is known to have some proxy issue since the beginning. This problem has been known since the beginning of aurora (I reported it to the managers more than 9 years ago...). this is one of the reasons why aurora specific support has been removed for version 3 of the connector.

If this is the culprit, the workaround is to set option 'disablePipeline' in connection url, like 'jdbc:mariadb://myhost/db?disablePipeline=true'

Generated at Thu Feb 08 03:20:25 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.