ODBC Connection Issues Causing Compile Errors
This section outlines how hung ODBC connections can cause compile errors.
This is an example of an ODBC connection:
local conn = db.connect{
api=db.SQL_SERVER,
name='your_odbc_server_name',
user='', -- use empty string for integrated security
password='', -- use empty string for integrated security
use_unicode = true,
live = true
}Issue
If this ODBC connection hangs for any reason, (i.e. external database issues, database has been decommissioned, etc) then you may encounter issues and errors including:
Failed to compile error:
[string "E:\IguanaApp\extensions/edit\admin\he..."]:365: Timed out - script took longer than 20 seconds to compile.
If the ODBC connection is outside of main, or in other words, persistent connections are being made, then upon channel startup, it will timeout and log an error stating it has failed to compile.
Failed to switch to a different commit error:
Could not switch to E:\IguanaApp\extensions/edit\admin\he.... Bad file path 'E:\IguanaConfig\edit\<Iguana User>\<ChannelGUID>\E:\IguanaApp\extensions\edit\admin\he...'
Failing to load annotations within the Iguana translator:
Since one hung ODBC connection will cause other ODBC connections to hang, it will affect all other channels that are trying to connect to a database.
Failing to stop Iguana in a timely manner:
If you find that on a attempt to stop the service through Windows Services, you may find that it takes a long time to stop, and displays an error message that it failed to stop timely. This is due to a hung database connection that stalls the shutdown process. You can prevent this by stopping all channels first prior to shutting down the service.
Solution
We strongly recommend looking into which ODBC connection(s) are hanging first to identify and resolve the root cause.
A troubleshooting step that can be done for investigation purposes is to navigate to http://localhost:6543/socket_diagnostic.html where "localhost:6543" is the address of your Iguana instance, and determine the statuses of your database connections.
If you cannot easily identify which ODBC connections are hanging, a temporary solution is to set the following environmental variable in Iguana under Settings → Environmental Variables. This is a temporary solution that does not fix or address the hung ODBC connection(s).
IGUANA_USE_ODBC_LOCK = no
For context, Iguana uses an ODBC library under the hood to make its ODBC database calls. A long time ago we found that there was an issue relating to this library, in that some database drivers and functions were not thread-safe, which resulted in Iguana crashing. This was reported to happen with SQL Server 2003.
The solution at the time was to serialize/lock all ODBC calls by default, which solved the problem. Of course, since all ODBC call are now serialized, one ODBC call hanging will cause all subsequent ODBC calls to hang as well. We can set the “IGUANA_USE_ODBC_LOCK” environmental variable to disable serialization of ODBC calls.
The ODBC library and database drivers that Iguana uses have been updated many times since, and the original thread-safe problem has been resolved.
After you have identified the root cause of the hung ODBC connection, you can safely remove this environmental variable.