Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Modify the sqlite3_log() interface and implementation so that it never uses dynamic memory allocation - to avoid deadlocking when called while holding the memory allocator mutex. Cherry-pick merge of [28d1bc98d6]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | branch-3.6.22 |
Files: | files | file ages | folders |
SHA1: |
6f368b5448363ae497bd4ff49b4ceeaf |
User & Date: | drh 2010-03-03 22:40:10 |
Context
2010-03-22
| ||
23:55 | Sync the database file after a rollback. This is a cherrypick merge of check-in [b21b911f23]. (Leaf check-in: 82dd61fc user: drh tags: branch-3.6.22) | |
2010-03-03
| ||
22:40 | Modify the sqlite3_log() interface and implementation so that it never uses dynamic memory allocation - to avoid deadlocking when called while holding the memory allocator mutex. Cherry-pick merge of [28d1bc98d6]. (check-in: 6f368b54 user: drh tags: branch-3.6.22) | |
00:02 | When TEMP files are in memory, also put the massive TEMP file used by the VACUUM command in memory. This is a cherry-pick merge of [9daf4e7d07] (check-in: e5342234 user: drh tags: branch-3.6.22) | |
Changes
Changes to src/printf.c.
︙ | ︙ | |||
932 933 934 935 936 937 938 939 940 941 942 943 | acc.useMalloc = 0; va_start(ap,zFormat); sqlite3VXPrintf(&acc, 0, zFormat, ap); va_end(ap); z = sqlite3StrAccumFinish(&acc); return z; } /* ** Format and write a message to the log if logging is enabled. */ void sqlite3_log(int iErrCode, const char *zFormat, ...){ | > > > > > > > > > > > > > > > > > > > > > > > > < < < < | < < | < < < < | 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 | acc.useMalloc = 0; va_start(ap,zFormat); sqlite3VXPrintf(&acc, 0, zFormat, ap); va_end(ap); z = sqlite3StrAccumFinish(&acc); return z; } /* ** This is the routine that actually formats the sqlite3_log() message. ** We house it in a separate routine from sqlite3_log() to avoid using ** stack space on small-stack systems when logging is disabled. ** ** sqlite3_log() must render into a static buffer. It cannot dynamically ** allocate memory because it might be called while the memory allocator ** mutex is held. */ static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){ StrAccum acc; /* String accumulator */ #ifdef SQLITE_SMALL_STACK char zMsg[150]; /* Complete log message */ #else char zMsg[400]; /* Complete log message */ #endif sqlite3StrAccumInit(&acc, zMsg, sizeof(zMsg), 0); acc.useMalloc = 0; sqlite3VXPrintf(&acc, 0, zFormat, ap); sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode, sqlite3StrAccumFinish(&acc)); } /* ** Format and write a message to the log if logging is enabled. */ void sqlite3_log(int iErrCode, const char *zFormat, ...){ va_list ap; /* Vararg list */ if( sqlite3GlobalConfig.xLog ){ va_start(ap, zFormat); renderLogMsg(iErrCode, zFormat, ap); va_end(ap); } } #if defined(SQLITE_DEBUG) /* ** A version of printf() that understands %lld. Used for debugging. ** The printf() built into some versions of windows does not understand %lld |
︙ | ︙ |
Changes to src/sqlite.h.in.
︙ | ︙ | |||
5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 | ** ^The [sqlite3_log()] interface writes a message into the error log ** established by the [SQLITE_CONFIG_ERRORLOG] option to [sqlite3_config()]. ** ** The sqlite3_log() interface is intended for use by extensions such as ** virtual tables, collating functions, and SQL functions. While there is ** nothing to prevent an application from calling sqlite3_log(), doing so ** is considered bad form. */ void sqlite3_log(int iErrCode, const char *zFormat, ...); /* ** Undo the hack that converts floating point types to integer for ** builds on processors without floating point support. */ | > > > > > > | 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 | ** ^The [sqlite3_log()] interface writes a message into the error log ** established by the [SQLITE_CONFIG_ERRORLOG] option to [sqlite3_config()]. ** ** The sqlite3_log() interface is intended for use by extensions such as ** virtual tables, collating functions, and SQL functions. While there is ** nothing to prevent an application from calling sqlite3_log(), doing so ** is considered bad form. ** ** To avoid deadlocks and other threading problems, the sqlite3_log() routine ** will not use dynamically allocated memory. The log message is stored in ** a fixed-length buffer on the stack. If the log message is longer than ** a few hundred characters, it will be truncated to the length of the ** buffer. */ void sqlite3_log(int iErrCode, const char *zFormat, ...); /* ** Undo the hack that converts floating point types to integer for ** builds on processors without floating point support. */ |
︙ | ︙ |