Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fatal] process 4812 has not started #8205

Closed
jessezwd opened this issue Dec 17, 2020 · 4 comments · Fixed by #8213
Closed

[fatal] process 4812 has not started #8205

jessezwd opened this issue Dec 17, 2020 · 4 comments · Fixed by #8213

Comments

@jessezwd
Copy link

I am running Redis 6.0.9 on MacOS Big Sur, when running 'make test', I got the following error:
!!! WARNING The following tests failed:

*** [err]: Check for memory leaks (pid 4812) in tests/integration/rdb.tcl
Expected '0 leaks' to equal or match 'leaks[4899]: [fatal] process 4812 has not started'

I don't know if this is a bug or not, I report it anyway.
BTW, redis server and redis cli start Ok.

@oranagra
Copy link
Member

@jessezwd what hardware do you use? is it ARM or x86?
can you try Redis 6.2 or the unstable branch?

@jessezwd
Copy link
Author

I use x86. If Redis 6.0.9 works ok, I may not try Redis 6.2 currently. Thanks for your comment.

@yangbodong22011
Copy link
Collaborator

*** [err]: Check for memory leaks (pid 4812) in tests/integration/rdb.tcl
Expected '0 leaks' to equal or match 'leaks[4899]: [fatal] process 4812 has not started'

From the error log, I noticed that this is not a leak, but because your Redis process has exited before leaks $pid is executed, [fatal] process 4812 has not started

I found that on different versions of macOS, leaks $pid (when $pid no longer exists), the error message is different :

macOs High Sierra
➜  ~ leaks 55555
leaks[52095]: leaks cannot examine process 55555 (with name like '55555') because it no longer appears to be running.


MacOS Big Sur 
➜  ~ leaks 55555
leaks[27180]: leaks cannot examine process 55555 (with name like '55555') because it no longer appears to be running.
leaks[27180]: [fatal] mach port for process 55555 not valid

Current code uses string match to determine whether the process exists, I think it can be modified to directly determine whether the process is alive.

diff --git a/tests/support/server.tcl b/tests/support/server.tcl
index ae93ad007..45861ebc2 100644
--- a/tests/support/server.tcl
+++ b/tests/support/server.tcl
@@ -51,8 +51,7 @@ proc kill_server config {
                     test "Check for memory leaks (pid $pid)" {
                         set output {0 leaks}
                         catch {exec leaks $pid} output
-                        if {[string match {*process does not exist*} $output] ||
-                            [string match {*cannot examine*} $output]} {
+                        if {![is_alive $config]} {
                             # In a few tests we kill the server process.
                             set output "0 leaks"
                         }

@yangbodong22011
Copy link
Collaborator

@jessezwd Hello, can you help transplant this commit code and test it on your computer?

diff --git a/tests/support/server.tcl b/tests/support/server.tcl
index 1cddb7068..77ba31d84 100644
--- a/tests/support/server.tcl
+++ b/tests/support/server.tcl
@@ -50,11 +50,17 @@ proc kill_server config {
                 tags {"leaks"} {
                     test "Check for memory leaks (pid $pid)" {
                         set output {0 leaks}
-                        catch {exec leaks $pid} output
-                        if {[string match {*process does not exist*} $output] ||
-                            [string match {*cannot examine*} $output]} {
-                            # In a few tests we kill the server process.
-                            set output "0 leaks"
+                        catch {exec leaks $pid} output option
+                        # In a few tests we kill the server process, so leaks will not find it.
+                        # It'll exits with exit code >1 on error, so we ignore these.
+                        if {[dict exists $option -errorcode]} {
+                            set details [dict get $option -errorcode]
+                            if {[lindex $details 0] eq "CHILDSTATUS"} {
+                                  set status [lindex $details 2]
+                                  if {$status > 1} {
+                                      set output "0 leaks"
+                                  }
+                            }
                         }
                         set output
                     } {*0 leaks*}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants