Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translating from a sentence often generates duplicates #1109

Closed
RyckRichards opened this issue Apr 23, 2016 · 3 comments
Closed

Translating from a sentence often generates duplicates #1109

RyckRichards opened this issue Apr 23, 2016 · 3 comments
Assignees
Labels
bug Issue that describes a problem with a feature that doesn't work as expected.
Milestone

Comments

@RyckRichards
Copy link
Member

Reported by GrizaLeono, Wezel and soweli_Elepanto on the Wall:

Il arrive parfois que j'envoie une phrase, qui ensuite apparaît avec deux numéros consécutifs, par exemple les phrases #5075133 et #5075134.

Cela arrive quand vous pressez le bouton « traduire » deux fois par mégarde. Une fois, j’en ai eu quatre, ces doubles.

I met such a problem too:
https://tatoeba.org/rus/sentences/show/5078678
https://tatoeba.org/rus/sentences/show/5078679
It might be an bug in the software of the site.

@trang trang added the bug Issue that describes a problem with a feature that doesn't work as expected. label Apr 24, 2016
@ventice
Copy link
Contributor

ventice commented Apr 30, 2016

I've seen this myself several times during batch translations (100 sentences per session). Frequency of this bug appears to be 1 or 2 out of 100 translations. So, I guess it has some race condition issue behind it which means that the bug should be fixed more by elaborate analysis rather than by reproduction.
I'll try to do it.

@ventice
Copy link
Contributor

ventice commented May 18, 2016

Looks like some echo from bug that unbind() on app/webroot/js/sentences.add_translation.js:35 was called to fix. When I commented it down, I got 6 instances of the sentence added. Looks like the second click sometimes occurs before unbind is run, which causes double request. I think unbinding isn't a stable solution - we have to hold registry of currently active requests and if second request arrives while another one is still active, discard it.

@ventice
Copy link
Contributor

ventice commented May 18, 2016

Yes the reason was related to 'unbind()' but in a little different way. Actually, the original bug description provided a way to reproduce this bug with 100% guarantee:

Cela arrive quand vous pressez le bouton «traduire» deux fois par mégarde. Une fois, j’en ai eu quatre, ces doubles.

Initially I thought that the author intended the button "Submit translation" with «traduire» but now I see that he/she meant the button that opens the translation controls - if you click the translate button while the controls are already open, you get second instances of event handlers bound to buttons and textarea so, when pressing the button you get two calls (that are execute both even though unbind is called in the first one). This can be worked around by the registry I mentioned, but it's easier to unbind event handlers immediately before binding them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue that describes a problem with a feature that doesn't work as expected.
Projects
None yet
Development

No branches or pull requests

3 participants