Author Topic: Starting campaign causes "Batch update returned unexpected row count" crash  (Read 6090 times)

ricksebak

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
    • Email
When I go to "View Live > Available Campaigns > Click on my campaign > Start campaign" the expected phone calls never happen. Catalina.log shows that wombat is hitting the below error. Anybody know how to solve this, or even how to make Wombat tell me which particular rows it is complaining about? If I knew which query was returning an unexpected number of rows, I could probably figure out what I did wrong.



Nov 12, 2015 3:03:10 PM ch.loway.app.wombat.dialer.WombatDialerWatchdog notifyEr
rorServer
SEVERE: -- Inner Exception --
Exception: java.lang.IllegalThreadStateException
Error:
-- Inner Exception --
Exception: org.hibernate.jdbc.BatchedTooManyRowsAffectedException
Error:
Batch update returned unexpected row count from update
  • ; actual row count: 2;

 expected: 1
Stack trace:
org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned un
expected row count from update
  • ; actual row count: 2; expected: 1

        at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expecta
tions.java:95)
        at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expect
ations.java:70)
        at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.jav
a:90)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.jav
a:70)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:
268)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.j
ava:114)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.j
ava:109)
        at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatc
her.java:244)
        at org.hibernate.persister.collection.BasicCollectionPersister.doUpdateR
ows(BasicCollectionPersister.java:216)
        at org.hibernate.persister.collection.AbstractCollectionPersister.update
Rows(AbstractCollectionPersister.java:1541)
        at org.hibernate.action.CollectionUpdateAction.execute(CollectionUpdateA
ction.java:85)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:170)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio
ns(AbstractFlushingEventListener.java:321)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus
hEventListener.java:50)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.commitOnTimeout(Wombat
DialerProcess.java:1792)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.processWombatBrain(Wom
batDialerProcess.java:643)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.runIteration(WombatDialerProcess.java:243)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.run(WombatDialerProcess.java:154)
        at ch.loway.oss.slicedbread.MessagingConsole$1.run(MessagingConsole.java:191)
        at java.lang.Thread.run(Thread.java:745)
-- End Inner Exception --



Edit: I think I found the query via MySQL's slow log:

SELECT c.campaignId, c.name,  c.securityKey, hopper.runMode, count(*) as NUM  FROM campaigns c    LEFT JOIN hopper ON c.campaignId = hopper.campaign   WHERE c.pace = 'RUNNABLE'  GROUP BY c.campaignId, c.name,  c.securityKey, hopper.runMode;
+------------+------------+-------------+-----------+-----+
| campaignId | name       | securityKey | runMode   | NUM |
+------------+------------+-------------+-----------+-----+
|          1 | mycampaign |             | COMPLETED |  11 |
|          1 | mycampaign |             | UNSAVED   |  10 |
+------------+------------+-------------+-----------+-----+
2 rows in set (0.00 sec)


I'm still not sure how to fix this, though. Delete one of those rows?
« Last Edit: November 12, 2015, 21:42:18 by ricksebak »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
I would try:
- stop the dialer
- make a backup of the DB
- delete all rows from hopper, hop_calls and hop_lists
- restart

If you can send us the database dump to our email support, we can see if there is a workaround to avoid such situations in the future.

ricksebak

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
    • Email
Thanks for investigating this.

I did as you suggested, and then attempted to start my campaign again. However, calls are still broken, and my Tomcat logs still produce a similar error (below). I verified that the previously mentioned query now returns only 1 row (the UNSAVED row).

Do you have any other suggestions?

I have emailed a copy of my database, from prior to deleting anything, to support at loway dot ch. SUP #24271


Stack trace:
java.lang.IllegalThreadStateException: -- Inner Exception --
Exception: org.hibernate.jdbc.BatchedTooManyRowsAffectedException
Error:
Batch update returned unexpected row count from update
  • ; actual row count: 2;

 expected: 1
Stack trace:
org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned un
expected row count from update
  • ; actual row count: 2; expected: 1

        at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expecta
tions.java:95)
        at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expect
ations.java:70)
        at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.jav
a:90)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.jav
a:70)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:
268)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.j
ava:114)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.j
ava:109)
        at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatc
her.java:244)
        at org.hibernate.persister.collection.BasicCollectionPersister.doUpdateR
ows(BasicCollectionPersister.java:216)
        at org.hibernate.persister.collection.AbstractCollectionPersister.update
Rows(AbstractCollectionPersister.java:1541)
        at org.hibernate.action.CollectionUpdateAction.execute(CollectionUpdateA
ction.java:85)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:170)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.commitOnTimeout(WombatDialerProcess.java:1792)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.processWombatBrain(WombatDialerProcess.java:643)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.runIteration(WombatDialerProcess.java:243)
        at ch.loway.app.wombat.dialer.WombatDialerProcess.run(WombatDialerProcess.java:154)
        at ch.loway.oss.slicedbread.MessagingConsole$1.run(MessagingConsole.java:191)
        at java.lang.Thread.run(Thread.java:745)
-- End Inner Exception --

« Last Edit: November 17, 2015, 21:20:47 by ricksebak »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
We trac this as bug #2943

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
If your tpf.properties says "useBatchUpdate" in the driver specs, please remove it.
We are about to release a new version of Wombat that should fix this error in its many ramifications.