Skip to content

Commit d1dff8c

Browse files
move memory check before rocksdb to avoid crash in child
1 parent 86ef832 commit d1dff8c

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

src/server.cpp

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7566,6 +7566,29 @@ int main(int argc, char **argv) {
75667566

75677567
validateConfiguration();
75687568

7569+
if (!g_pserver->sentinel_mode) {
7570+
#ifdef __linux__
7571+
linuxMemoryWarnings();
7572+
#if defined (__arm64__)
7573+
int ret;
7574+
if ((ret = linuxMadvFreeForkBugCheck())) {
7575+
if (ret == 1)
7576+
serverLog(LL_WARNING,"WARNING Your kernel has a bug that could lead to data corruption during background save. "
7577+
"Please upgrade to the latest stable kernel.");
7578+
else
7579+
serverLog(LL_WARNING, "Failed to test the kernel for a bug that could lead to data corruption during background save. "
7580+
"Your system could be affected, please report this error.");
7581+
if (!checkIgnoreWarning("ARM64-COW-BUG")) {
7582+
serverLog(LL_WARNING,"KeyDB will now exit to prevent data corruption. "
7583+
"Note that it is possible to suppress this warning by setting the following config: ignore-warnings ARM64-COW-BUG");
7584+
exit(1);
7585+
}
7586+
}
7587+
#endif /* __arm64__ */
7588+
#endif /* __linux__ */
7589+
}
7590+
7591+
75697592
const char *err;
75707593
if (!initializeStorageProvider(&err))
75717594
{
@@ -7591,25 +7614,6 @@ int main(int argc, char **argv) {
75917614
if (!g_pserver->sentinel_mode) {
75927615
/* Things not needed when running in Sentinel mode. */
75937616
serverLog(LL_WARNING,"Server initialized");
7594-
#ifdef __linux__
7595-
linuxMemoryWarnings();
7596-
#if defined (__arm64__)
7597-
int ret;
7598-
if ((ret = linuxMadvFreeForkBugCheck())) {
7599-
if (ret == 1)
7600-
serverLog(LL_WARNING,"WARNING Your kernel has a bug that could lead to data corruption during background save. "
7601-
"Please upgrade to the latest stable kernel.");
7602-
else
7603-
serverLog(LL_WARNING, "Failed to test the kernel for a bug that could lead to data corruption during background save. "
7604-
"Your system could be affected, please report this error.");
7605-
if (!checkIgnoreWarning("ARM64-COW-BUG")) {
7606-
serverLog(LL_WARNING,"KeyDB will now exit to prevent data corruption. "
7607-
"Note that it is possible to suppress this warning by setting the following config: ignore-warnings ARM64-COW-BUG");
7608-
exit(1);
7609-
}
7610-
}
7611-
#endif /* __arm64__ */
7612-
#endif /* __linux__ */
76137617
moduleInitModulesSystemLast();
76147618
moduleLoadFromQueue();
76157619
ACLLoadUsersAtStartup();

0 commit comments

Comments
 (0)