You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my db is using GetExactTimeStampUTC function, which was declared like in fbudf.sql supplied with Firebird server:
declare external function getExactTimestampUTC
timestamp
returns parameter 1
entry_point 'getExactTimestampUTC' module_name 'fbudf';
Issue was found when I exported my db as SQL script wia Firebird Maestro. That`s how it exports getExactTimestampUtc
DECLARE EXTERNAL FUNCTION GETEXACTTIMESTAMPUTC
RETURNS TIMESTAMP
ENTRY_POINT 'getExactTimestampUTC' MODULE_NAME 'fbudf';
When I try to use udf in recreated db, server crases with a message:
The user defined function: GETEXACTTIMESTAMPUTC
referencing entrypoint: getExactTimestampUTC
in module: fbudf
caused the fatal exception: Access violation.
The code attempted to access a virtual
address without privilege to do so.
This exception will cause the Firebird server
to terminate abnormally.
It`s certainly a bug of Firebird Maestro. But the fact that server crashed cause of this is a bug of FB Server, imho
The text was updated successfully, but these errors were encountered:
Server has absolutely no way to know, how to call UDF, except using information in 'DECLARE EXTERNAL FUNCTION' operator. Imagine you invoke C-function, which expects some parameter to be passed, but instead receives garbage on the stack. No surprise that access violation happens when it's called. This is exactly what happened in your case. Firebird server detects access violation (you see it reported in the log file), and in theory can attempt to continue operation. But (and it was discussed many times before) it's very dangerous from database integrity POV - who knows, what dangerous things might do badly written/called UDF (remember, we can't distinguish that cases) before AV? For example, it could damage database pages buffer. Therefore the only safe action after AV in UDF is to try to log it and restart.
I understand this, and it`s a pity, but question not about calling of udf, but declaration.
Exceptions and processes inside UDF are problems of udf developers, but everybody can declare funciton with wrong params that crashes DBS.
Just a suggestion:
I think It would be better to store info about parameters inside library with UDFs. In this case It`s much harder to declare different parameters. When server processing declaration statement It could check parameters declared by user.
In this case userside declaration can be simplified and look like this:
DECLARE EXTERNAL FUNCTION 'FunctionName'
ENTRY_POINT 'LibNunctionName' MODULE_NAME 'library';
Submitted by: Konstantin Dombrugov (abracadabra)
my db is using GetExactTimeStampUTC function, which was declared like in fbudf.sql supplied with Firebird server:
declare external function getExactTimestampUTC
timestamp
returns parameter 1
entry_point 'getExactTimestampUTC' module_name 'fbudf';
Issue was found when I exported my db as SQL script wia Firebird Maestro. That`s how it exports getExactTimestampUtc
DECLARE EXTERNAL FUNCTION GETEXACTTIMESTAMPUTC
RETURNS TIMESTAMP
ENTRY_POINT 'getExactTimestampUTC' MODULE_NAME 'fbudf';
When I try to use udf in recreated db, server crases with a message:
The user defined function: GETEXACTTIMESTAMPUTC
referencing entrypoint: getExactTimestampUTC
in module: fbudf
caused the fatal exception: Access violation.
The code attempted to access a virtual
address without privilege to do so.
This exception will cause the Firebird server
to terminate abnormally.
It`s certainly a bug of Firebird Maestro. But the fact that server crashed cause of this is a bug of FB Server, imho
The text was updated successfully, but these errors were encountered: