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

Request synchronization error with SUSPEND inside two exceptions handling blocks (specific and common) [CORE3410] #1323

Open
firebird-automations opened this issue Mar 24, 2011 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Vladimir Arkhipov (arkinform)

Votes: 2

The following simple procedure works fine and returns 'Error3'.

create or alter procedure TEST
returns
(
error_text varchar(1024)
)
as
begin
in autonomous transaction do
begin
exception error 'Error1';

when exception error do
begin
  error\_text = 'Error2';
  exception;
end

end

when exception error do
begin
error_text = 'Error3';
suspend;
end
end

But if I add extra handling "when any do" to the end of procedure, then request synchronization error occurs.

create or alter procedure TEST
returns
(
error_text varchar(1024)
)
as
begin
in autonomous transaction do
begin
exception error 'Error1';

when exception error do
begin
  error\_text = 'Error2';
  exception;
end

end

when exception error do
begin
error_text = 'Error3';
suspend;
end

when any do
begin
error_text = 'Error4';
suspend;
end
end

May be usage of exception handling in autonomous transaction block is wrong in principle?!
But in some cases it is needed for rollback all autonomous actions and receive information about state from transactional context variables, for example.

@firebird-automations
Copy link
Collaborator Author

Modified by: Vladimir Arkhipov (arkinform)

Version: 2.5.1 [ 10333 ]

Version: 3.0 Alpha 1 [ 10331 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

I see the same request sync error even if the IN AUTONOMOUS TRANSACTION line is commented out, so it seems the problem lies elsewhere. Can you confirm that?

@firebird-automations
Copy link
Collaborator Author

Commented by: Vladimir Arkhipov (arkinform)

Yes, I confirm it. When I select from the following procedure, then request synchronization error occurs:

create or alter procedure TEST
returns
(
ERROR_TEXT varchar(1024)
)
as
begin
exception error 'Error1';

when exception error do
begin
error_text = 'Error3';
suspend;
end

when any do
begin
error_text = 'Error4';
suspend;
end
end

See the following example. I only replace first line "exception error ..." to "exception error2 ..." (new exception). No errors!

create or alter procedure TEST
returns
(
ERROR_TEXT varchar(1024)
)
as
begin
exception error2 'Error1';

when exception error do
begin
error_text = 'Error3';
suspend;
end

when any do
begin
error_text = 'Error4';
suspend;
end
end

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

With exception "error" both exception handlers work, while in your last example (exception "error2") only the last one (when any) handles the exception. This fact somehow triggers the error.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Version: 2.1.4 [ 10361 ]

Version: 2.0.6 [ 10303 ]

Version: 3.0 Initial [ 10301 ]

Version: 1.5.6 [ 10225 ]

Version: 2.1.3 [ 10302 ]

Version: 2.1.2 [ 10270 ]

Version: 2.0.5 [ 10222 ]

Version: 2.1.1 [ 10223 ]

Version: 2.0.4 [ 10211 ]

Version: 2.1.0 [ 10041 ]

summary: Request synchronization error with autonomous transaction and exceptions handling => Request synchronization error with SUSPEND inside two exceptions handling blocks (specific and common)

@firebird-automations
Copy link
Collaborator Author

Commented by: Vannus (vannus)

Dmitry, I also get the problem when not using IN AUTONOMOUS TRANSACTION.

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

status: In Progress [ 3 ] => Open [ 1 ]

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