Skip to content

Conversation

sahilarora946
Copy link

Description

This fixes the issue described in #230

Related issues

#129

Refer to rollback function in https://github.com/zbarbuto/loopback-connector-postgresql/blob/1361460cea86fadd14a68aa8fe9c55f14ecb9a6d/lib/transaction.js#L58-L86

After the ROLLBACK is executed, callback will be sent to the event loop to be executed. Event loop can pick any of the available callbacks to execute. It can pick another function that can do database calls in the same transaction and because releaseConnection has not been called, the statement will execute.
To stop the execution,connection.txId should be set to null without waiting for the callback of ROLLBACK to be called

@slnode
Copy link

slnode commented Apr 24, 2018

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@zbarbuto
Copy link
Contributor

@slnode test please

@sahilarora946
Copy link
Author

@zbarbuto why are these tests failing?

@zbarbuto
Copy link
Contributor

zbarbuto commented Apr 24, 2018

Unfortunately I don't have permission to view the CI. Will have to wait for one of the admins to have a look.

cc @raymondfeng , @dhmlau , @b-admike could one of you possibly take it from here?

@dhmlau
Copy link
Member

dhmlau commented May 8, 2018

@slnode test please

@dhmlau
Copy link
Member

dhmlau commented May 8, 2018

@zbarbuto , sorry about the late reply. There was an CI issue that we ran into before. I thought it's been fixed. Let me kick off CI again to check.

@dhmlau
Copy link
Member

dhmlau commented May 8, 2018

CI all passed.
@sahilarora946 , could you please rebase your PR? Thanks.

@sahilarora946 sahilarora946 force-pushed the stop-execution-of-query-after-rollback branch from e4b5eaf to 8e5314c Compare May 11, 2018 08:20
stop execution if rollback is called stop execution if rollback is called
@sahilarora946 sahilarora946 force-pushed the stop-execution-of-query-after-rollback branch from 8e5314c to 8a06ce8 Compare May 11, 2018 08:37
@sahilarora946
Copy link
Author

@dhmlau rebase done

@dhmlau
Copy link
Member

dhmlau commented May 15, 2018

@slnode test please

@dhmlau
Copy link
Member

dhmlau commented May 18, 2018

@zbarbuto @strongloop/sq-lb-apex , PTAL.
I'm not very familiar with transaction.

@zbarbuto
Copy link
Contributor

LGTM - I'm a bit out of the loop on it also, though. @raymondfeng comes to mind, maybe give it a quick once over and then should be able to merge?

@zbarbuto zbarbuto requested a review from raymondfeng May 18, 2018 01:08
@b-admike
Copy link
Contributor

Thank you for your contribution @sahilarora946. Taking a look. I'm wondering if we can simulate the behaviour that causes this issue in a test.

@b-admike
Copy link
Contributor

the PR LGTM, but I recommend adding a test which can simulate the scenario/bug we are fixing to avoid regressions in the future. @raymondfeng can you PTAL?

@sahilarora946
Copy link
Author

@b-admike sorry, i can't think of how we can simulate this behaviour.

@dhmlau dhmlau merged commit d88257b into loopbackio:master May 23, 2018
@dhmlau
Copy link
Member

dhmlau commented May 25, 2018

Released as 3.3.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants