Bug 1008251

Summary: Rejected translation will cause an error in TM
Product: [Retired] Zanata Reporter: Patrick Huang <pahuang>
Component: Component-LogicAssignee: Patrick Huang <pahuang>
Status: CLOSED CURRENTRELEASE QA Contact: Ding-Yi Chen <dchen>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 3.0CC: dchen, djansen, sflaniga, zanata-bugs
Target Milestone: ---   
Target Release: 3.2   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: 3.2-SNAPSHOT (20131112-0036) Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-18 06:48:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Patrick Huang 2013-09-15 23:40:53 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31
Build Identifier: 

When rejects a Translated or Approved translation, afterwards TM will refresh and it will encounter an error (viewable in browser console or server log). Debugging shows lucene search returns the newly Rejected translation even though we ask it to exclude Rejected state. Revisit the row (i.e.by move down then up again) this error goes away. I think this is because lucene index update is not synchronized with the database change. When the TM request comes in lucene still thinks the string is in previous state and serves it up. And the database (or perhaps ehcache) returns the actual object the state became Rejected.

Reproducible: Always

Steps to Reproduce:
1. Find a string with Translated or Approved state
2. Reject it
3. Check Firefox firebug console or Chrome console or server log
Actual Results:  
09:27:32,813 ERROR [org.zanata.webtrans.server.SeamDispatch] (http-/0.0.0.0:9898-4) Error dispatching action: java.lang.RuntimeException: Cannot map content state: Rejected
: java.lang.RuntimeException: Cannot map content state: Rejected
        at org.zanata.webtrans.server.rpc.GetTransMemoryHandler.fromContentState(GetTransMemoryHandler.java:164) [classes:]
        at org.zanata.webtrans.server.rpc.GetTransMemoryHandler.processIndexMatch(GetTransMemoryHandler.java:139) [classes:]
        at org.zanata.webtrans.server.rpc.GetTransMemoryHandler.searchTransMemory(GetTransMemoryHandler.java:104) [classes:]
        at org.zanata.webtrans.server.rpc.GetTransMemoryHandler.execute(GetTransMemoryHandler.java:88) [classes:]
        at org.zanata.webtrans.server.rpc.GetTransMemoryHandler.execute(GetTransMemoryHandler.java:1) [classes:]


Expected Results:  
Should not return Rejected translation as TM result

Comment 1 Patrick Huang 2013-09-16 01:55:08 UTC
doesn't seem to easily reproducible. Could be just timing issue.

Comment 2 Patrick Huang 2013-09-17 05:04:10 UTC
https://github.com/zanata/zanata-server/pull/181

Comment 3 Sean Flanigan 2013-09-18 00:16:23 UTC
See also bug 997717.

Comment 4 Patrick Huang 2013-09-18 00:24:49 UTC
*** Bug 997717 has been marked as a duplicate of this bug. ***

Comment 5 Ding-Yi Chen 2013-11-12 07:03:35 UTC
VERIFIED with Zanata version 3.2-SNAPSHOT (20131112-0036)