Skip to content

Commit

Permalink
Merge pull request #1291 from greenbone/helper-deadlock
Browse files Browse the repository at this point in the history
Skip DB check in helpers when main process is running
  • Loading branch information
mattmundell authored Sep 16, 2020
2 parents aa30945 + 0d6a0ba commit 09db986
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix alternative options for radio type preferences when exporting a scan_config [#1278](http://github.com/greenbone/gvmd/pull/1278)
- Replace deprecated sys_siglist with strsignal [#1280](https://github.com/greenbone/gvmd/pull/1280)
- Copy instead of moving when migrating predefined report formats [#1286](https://github.com/greenbone/gvmd/pull/1286)
- Skip DB check in helpers when main process is running [#1291](https://github.com/greenbone/gvmd/pull/1291)
- For radio prefs in GMP exclude value and include default [#1296](https://github.com/greenbone/gvmd/pull/1296)

### Removed
Expand Down
17 changes: 14 additions & 3 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -16414,8 +16414,13 @@ init_manage_internal (GSList *log_config,

if (skip_db_check == 0)
{
/* This only happens for init_manage callers with skip_db_check set, so
* there is ultimately only one caller case, the main process. */
/* This only happens for init_manage callers with skip_db_check set to 0
* and init_manage_helper callers. So there are only 2 callers:
*
* 1 the main process
* 2 a helper processes (--create-user, --get-users, etc) when the
* main process is not running. */

ret = check_db (check_encryption_key);
if (ret)
return ret;
Expand Down Expand Up @@ -16517,7 +16522,13 @@ init_manage_helper (GSList *log_config, const gchar *database,
0, /* Default max_email_message_size */
0, /* Stop active tasks. */
NULL,
0, /* Skip DB check. */
/* Skip DB check if main process is running, to
* avoid locking issues when creating tables.
*
* Safe because main process did the check. */
lockfile_locked ("gvm-serving")
? 1 /* Skip DB check. */
: 0, /* Do DB check. */
0); /* Dummy. */
}

Expand Down

0 comments on commit 09db986

Please sign in to comment.