Menu

#46 libodbc1: Truncates "odbc.ini" randomly under high load

open
nobody
libodbc1 (1)
3
2019-05-14
2019-05-14
No

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=885463

What led up to the situation?

 Using unixodbc + freetds as a backend to pyodbc with MS-SQL server under
 high load (many processes and threads using libodbc1 simultaneously).

 The file /etc/odbc.ini get randomly truncated, losing all connection data
 and rendering all programs using unixodbc useless until we restore odbc.ini
 from a backup.

What exactly did you do (or not do) that was effective (or ineffective)?

 No triggering action by the user or programs was found. The file
 is truncated seemingly at random. Many hours of high load may pass
 without problems. Under low load, the problem was never found.

Countermeasure we tried

 A watchdog program was installed which notices the truncation and
 replaces the file. Also, auditd was installed to track changes to
 odbc.ini, which confirmed libodbc1 as the culprit.

 This alleviates the situation, but does not solve the problem. During
 the short time until the watchdog notices the destruction, the other
 clients are still unusable.

The bug can be fixed by applying the attached patch.

The patch is very unobtrusive, it just replaces the "w" flag in fopen() calls with "a" in order to avoid wanton destruction.

I'm also sending this patch to Debian, please consider adding this. It adds considerable stability to the library.

1 Attachments

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.