GWT ORM OrmConcurrencyException: Concurrent modification detected - find the cause

巧了我就是萌 提交于 2020-01-07 01:49:35

问题


In a GWT based application (Google Gerrit in particular), I'm getting an exception (while executing the gerrit review command):

com.google.gwtorm.server.OrmConcurrencyException: Concurrent modification detected
       at com.google.gwtorm.jdbc.JdbcAccess.execute(JdbcAccess.java:449)
       at com.google.gwtorm.jdbc.JdbcAccess.updateAsBatch(JdbcAccess.java:270)
       at com.google.gwtorm.jdbc.JdbcAccess.update(JdbcAccess.java:223)

Is there a way to identify which data in particular caused the concurrency error?

Looking at the source code of GWT ORM, I'm assuming the UPDATE prepared statement didn't match the data to update and as a result nothing was updated. Finally, the OrmConcurrencyException was thrown to inform the caller.


回答1:


This can happen when gerrit review is executed in parallel.

For instance, as reported at https://code.google.com/p/gerrit/issues/detail?id=3730&thanks=3730&ts=1450711628, updating a --label of two different labels causes this error:

bash-3.2$ ssh robot@gerrit.foo.int gerrit review --label Verified=-1 \
    --message '"Verified .. -1."' 2463,9 & \
    ssh robot@gerrit.foo.int gerrit review --label Tested=+1 \
    --message '"Tested .. +1."' 2463,9 &
[3] 29329
[4] 29330
bash-3.2$
bash-3.2$ error: Cannot post review
one or more reviews failed; review output above

[3]   Done                    ssh robot@gerrit.foo.int gerrit review --label Verified=-1 --message '"Verified .. -1."' 2463,9
[4]   Exit 1                  ssh robot@gerrit.foo.int gerrit review --label Tested=+1 --message '"Tested .. +1."' 2463,9

It should be just ok to re-trigger one of the commands once again (or fix the reported issue).



来源:https://stackoverflow.com/questions/34397547/gwt-orm-ormconcurrencyexception-concurrent-modification-detected-find-the-cau

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!