Page MenuHomePhabricator

Flow: intermittent: 'exception caught: failed insert'
Closed, ResolvedPublic

Description

Flow exception

Seen in Chrome on beta labs 27 Dec:

For logged in user
Upon clicking the button to save edited Post information
Get red error message 'exception caught: failed insert'

Screen shot attached, also see https://saucelabs.com/jobs/91190676b4e34594886a5a881073464a for video.


Version: unspecified
Severity: normal

Attached:

Details

Reference
bz58996

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:28 AM
bzimport set Reference to bz58996.
bzimport added a subscriber: Unknown Object (MLST).

bingle-admin wrote:

The WMF core features team tracks this bug on Mingle card https://mingle.corp.wikimedia.org/projects/flow/cards/660, but people from the community are welcome to contribute here and in Gerrit.

(FYI to see beta labs errors, you need to be in the deployment-prep wmflabs project, then ssh deployment-bastion via bastion.wmflabs.org, then look in /data/project/logs .)

The test is the Selenium_user editing her own first post on her own new topic and submitting it. It's failed on December 26 and December 27 with DB error:

Duplicate entry '<UUID thingy>' for key 'flow_revision_unique_parent' (10.4.0.53)

exception.log contains

2013-12-27 15:36:24 deployment-apache32 enwiki: [63f46b3a] /w/api.php Exception from line 497 of /data/project/apache/common-local/php-master/extensions/Flow/includes/Data/ObjectManager.php: failed insert
#0 /data/project/apache/common-local/php-master/extensions/Flow/includes/Data/ObjectManager.php(469): Flow\Data\ObjectManager->insert(Object(Flow\Model\PostRevision))
#1 /data/project/apache/common-local/php-master/extensions/Flow/includes/Data/ObjectManager.php(167): Flow\Data\ObjectManager->put(Object(Flow\Model\PostRevision))
#2 /data/project/apache/common-local/php-master/extensions/Flow/includes/Block/Topic.php(296): Flow\Data\ManagerGroup->put(Object(Flow\Model\PostRevision))
#3 /data/project/apache/common-local/php-master/extensions/Flow/includes/WorkflowLoader.php(204): Flow\Block\TopicBlock->commit()
#4 /data/project/apache/common-local/php-master/extensions/Flow/includes/api/ApiFlow.php(59): Flow\WorkflowLoader->commit(Object(Flow\Model\Workflow), Array)
#5 /data/project/apache/common-local/php-master/includes/api/ApiMain.php(862): ApiFlow->execute()
#6 /data/project/apache/common-local/php-master/includes/api/ApiMain.php(387): ApiMain->executeAction()
#7 /data/project/apache/common-local/php-master/includes/api/ApiMain.php(358): ApiMain->executeActionWithErrorHandling()
#8 /data/project/apache/common-local/php-master/api.php(76): ApiMain->execute()

(I think Benny has a fix to actually print the exception details.)

The earlier exception.log error on 2013-12-26 15:29:43 is identical.

dberror.log contains:

Fri Dec 27 15:36:24 UTC 2013
deployment-apache32
enwiki
Flow\Data\RevisionStorage::insert
10.4.0.53
1062
Duplicate entry '^E^LÊÓ^Wý4¹@^]^B^V>92^?' for key 'flow_revision_unique_parent' (10.4.0.53)
INSERT  INTO `flow_revision`
       (rev_id,rev_user_id,rev_user_text,rev_parent_id,

rev_change_type,rev_type,rev_content,rev_flags,rev_mod_state,rev_mod_user_id,rev_mod_user_text,rev_mod_timestamp,rev_mod_reason,rev_last_edit_id,rev_edit_user_id,rev_edit_user_text)

VALUES (
        '^E^LÒÌ^\¥4¹@^]^B^V>92^?',
        '820',
        'Selenium user',
        '^E^LÊÓ^Wý4¹@^]^B^V>92^?',
        'flow-edit-post',
        'post',
        '-Ʊ\nÂ0^P\0Ðݯ8ºt<89>õ®iÒTj^G^Gg^G7q<88>^<84><80>p!  ^T^QÿÝÅ7½9^Aûê·Éç\"<91>^Oí§  á<92><9b>ý^U<95>Ó\n^UÞ¾ír^T~<83><áô<92>^U.<92>â^C;\"íHOÎØÁ^Q\ZÓÃ=ËZB®¡T^H^\ëæ,ÿ^EÆn\ZFCco  ¬EDMó.-?',
        'utf-8,gzip,html',
        '',NULL,NULL,NULL,NULL,'^E^LÒÌ^\¥4¹@^]^B^V>92^?',
        '820',
        'Selenium user'
)

and the earlier error has a similar dberror.log line: the inserted rev_parent_id triggers

Duplicate entry '^E^L¶' for key 'flow_revision_unique_parent' (10.4.0.53)

(^the actual parent_id is longer but the dberror log message is confused by the funky UUID characters; this might be part of the problem?

This is an edit conflict. It happens when overlapping Flow browser tests both try to edit the first post on a board.

The api.log contains (URL decoded)

2013-12-27 15:36:24 deployment-apache32 enwiki: API POST
Selenium_user 162.222.73.153 T=439ms
format=json action=flow flowaction=edit-post workflow=050ccad317f534b9401d02163e39327f params={"topic":

{"postId":"050ccad317fd34b9401d02163e39327f",
 "content":"Body of Flow Topic0.11381398564810552 browsertest edit\nPost edited0.4848066854649976"}

} token=abfff42f2b6779b57593fea823a02f72+\ render=true

2013-12-27 15:36:24 deployment-apache32 enwiki: API POST
Selenium_user 162.222.73.155 T=261ms
format=json action=flow flowaction=edit-post workflow=050ccad317f534b9401d02163e39327f params={"topic":

{"postId":"050ccad317fd34b9401d02163e39327f",
 "content":"Body of Flow Topic0.11381398564810552 browsertest edit\nPost edited0.947517256600031"}

} token=2e411023ff7ca5f37a6a74793562d0cf+\ render=true

I.e. two different IPs both editing the same post. One succeeds, the other reports the API error. It should report an edit conflict to the user.

I filed bug 59011 for the browser test to avoid the possible edit conflict.

Is there a story to handle edit conflict gracefully?

(In reply to comment #5)

Is there a story to handle edit conflict gracefully?

Yup, currently in-dev by Matthias, according to https://mingle.corp.wikimedia.org/projects/flow/cards/318

I'm getting the same error message ("An error occurred. The error message received was: Exception Caught: failed insert") when I try to "restore" Spage's post here: https://www.mediawiki.org/w/index.php?title=Talk:Sandbox&workflow=050bcc286f7e63ea2e7090b11c26f43c#flow-post-050bf86d5a12f77986f090b11c278532

(In reply to comment #7)

Hmm, my Special:Contributions claims that I successfully unhid the post:

"02:34, 31 December 2013 (topic | history) . . (0)‎ . . Quiddity (WMF) (talk | contribs | block) restored a comment (Unfoo! (useful comment, unhiding for access))."

But the post is still hidden, and there's no new entry in the Topic-History https://www.mediawiki.org/w/index.php?title=Talk:Sandbox&workflow=050bcc286f7e63ea2e7090b11c26f43c&action=topic-history

Change 106449 had a related patch set uploaded by EBernhardson:
Track the root of a post tree explicitly

https://gerrit.wikimedia.org/r/106449

Change 106449 merged by jenkins-bot:
Track the root of a post tree explicitly

https://gerrit.wikimedia.org/r/106449

Quiddity removed a subscriber: Maryana.Dec 19 2014, 1:39 AM