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

Can't launch Status app on Intel-based Mac #15134

Closed
qoqobolo opened this issue Jun 11, 2024 · 35 comments · Fixed by #15194
Closed

Can't launch Status app on Intel-based Mac #15134

qoqobolo opened this issue Jun 11, 2024 · 35 comments · Fixed by #15194
Assignees
Labels
bug Something isn't working crash infra-team macos
Milestone

Comments

@qoqobolo
Copy link

qoqobolo commented Jun 11, 2024

Bug Report

Description

Starting with RC 10 https://github.com/status-im/status-desktop/releases/tag/2.29.0-rc.10 I started experiencing a crash when launching the Status app.
The app crashes even before opening the login screen.

Screen.Recording.2024-06-11.at.11.12.20.mov

Logs:
desktop_rc11.log

I first faced this when I tried to open a build with my main user (community status member). Then I tried to install yesterday’s nightly and run it with another test user, who also had contacts and community.
The app crashed in both cases.

Then I tried deleting the data folder and launching the application.
The first 5 attempts the crash repeated, but then I was able to launch the app (without changing anything) and create a user.
After that, I could no longer log in to it.

Also, after creating another new user, I tried to open the QR code to sync with a mobile device, but I got a crash when opening the QR code. Here are the logs for this case:

DBG 2024-06-10 16:40:34.718+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=149156 file=core.nim:27 rpc_method=wakuext_getOurInstallations
DBG 2024-06-10 16:40:37.262+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=149027 file=core.nim:27 rpc_method=wakuext_speedupArchivesImport
DBG 2024-06-10 16:40:39.758+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=149027 file=core.nim:27 rpc_method=wakuext_slowdownArchivesImport
DBG 2024-06-10 16:40:39.772+02:00 NewBE_callPrivateRPC                       topics="rpc" tid=149027 file=core.nim:27 rpc_method=accounts_verifyPassword
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
zsh: segmentation fault  ./nim_status_client --datadir=~/Downloads/master/custom --LOG_LEVEL=DEBUG

My macOS updated yesterday to Sonoma 14.5, maybe this could be the reason? Or I am doing something wrong.
We couldn't reproduce this on any other Mac.

Additional Information

  • Status desktop version: RC 10, RC 11
  • Operating System: MacBook pro, Sonoma 14.5, Intel
@anastasiyaig
Copy link
Contributor

we need to get someone with Intel chip on mac to debug what is going on
@jrainville @iurimatias

@anastasiyaig anastasiyaig added this to the 2.30.0 Beta milestone Jun 11, 2024
@MishkaRogachev
Copy link
Contributor

MishkaRogachev commented Jun 11, 2024

Tried to reproduce on M1 Pro:

  • rc.10 without upgrading Mac OS
  • rc.10 after upgrading Mac OS on 14.5
  • rc.11
    Used arm64 architecture binaries, no crash for now.
    UPD: i have M1 😳
    UPD2: x86_64 build crashes on M1 either

@saledjenic
Copy link
Contributor

I was able to reproduce this crash on the app start (got exactly the same stacktrace), it has nothing with the specific Status data folder the app crashes because of the changed Go version. It has something with CGo bindings.

rc2.29 commit 441a802948d5a881b38de98dbf63408a1b893e6a (which is one before we changed Go version to 1.21) works fine.

Also if I change just the local Go version to 1.21 and try the same commit, getting this:

# github.com/anacrolix/go-libutp
vendor/github.com/anacrolix/go-libutp/callbacks.go:16:10: cannot define new methods on non-local type *C.utp_callback_arguments
vendor/github.com/anacrolix/go-libutp/callbacks.go:24:10: cannot define new methods on non-local type *C.utp_callback_arguments
vendor/github.com/anacrolix/go-libutp/callbacks.go:28:10: cannot define new methods on non-local type *C.utp_callback_arguments
vendor/github.com/anacrolix/go-libutp/callbacks.go:32:10: cannot define new methods on non-local type *C.utp_callback_arguments
vendor/github.com/anacrolix/go-libutp/callbacks.go:36:10: cannot define new methods on non-local type *C.utp_callback_arguments
vendor/github.com/anacrolix/go-libutp/utp.go:29:12: cannot define new methods on non-local type *C.utp_context
vendor/github.com/anacrolix/go-libutp/utp.go:40:12: cannot define new methods on non-local type *C.utp_context
make[1]: *** [statusgo-shared-library] Error 1
make: *** [vendor/status-go/build/bin/libstatus.dylib] Error 2

At this moment I am not pretty sure how to make it work on Mac Intel, maybe somebody more experienced in this field may help, otherwise I will most likely need much more time till I figure it out.

@igor-sirotin
Copy link
Contributor

I was able to reproduce this crash on the app start (got exactly the same stacktrace)

@saledjenic just to make it clear, this is on Intel mac only, right?

@igor-sirotin
Copy link
Contributor

Also if I change just the local Go version to 1.21 and try the same commit, getting this

This anacrolix/go-libutp errors you'll get if try to compile it with Go 1.21 without our code change. Andrea changed some build args for it to work.

@igor-sirotin
Copy link
Contributor

cc @siddarthkay
seems that we have a problem running status-desktop after on Intel MacOS after upgrading Go to 1.21

@saledjenic
Copy link
Contributor

@saledjenic just to make it clear, this is on Intel mac only, right?

Correct.

This anacrolix/go-libutp errors you'll get if try to compile it with Go 1.21 without our code change. Andrea changed some build args for it to work.

This is what I see when I try to run the rc2.29 commit 441a802948d5a881b38de98dbf63408a1b893e6a with Go1.21, without any additional changes, it runs fine with Go1.20.

The commit after it introduces the official changes that we did to switch to Go1.21, when I run it then I see the same stacktrace as in desktop_rc11.log posted in the description of this issue.

@siddarthkay
Copy link
Contributor

problem running status-desktop after on Intel MacOS after upgrading Go to 1.21

IMG_4895

@jrainville
Copy link
Member

@siddarthkay do you think it's possible to fix it or we should revert the upgrade to 1.21 for now?

@siddarthkay
Copy link
Contributor

@jrainville : I plan to do some investigations tomorrow and find the root cause of crash, if it is indeed related to go upgrade then the proper fix would most likely be additional build flags.
I'll keep this thread posted.

@jrainville jrainville moved this to Iteration Backlog in Status Desktop/Mobile Board Jun 12, 2024
@siddarthkay siddarthkay changed the title Can't launch Status app Can't launch Status app on intel MacOS Jun 13, 2024
@siddarthkay
Copy link
Contributor

siddarthkay commented Jun 14, 2024

The core error message worth investigating is this :

fatal error: bad sweepgen in refill

There is indeed an issue in go repo for this :
-> golang/go#64492

Other possibly related issues :
-> golang/go#38692 (comment)

@Samyoul
Copy link
Member

Samyoul commented Jun 14, 2024

@siddarthkay Your magic binary worked for me

@Samyoul
Copy link
Member

Samyoul commented Jun 17, 2024

Hmmmm, @siddarthkay :(

So I've tried to open the Desktop app again today and it is crashing before even loading. I haven't changed anything.

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               nim_status_client [27134]
Path:                  /Applications/Status.app/Contents/MacOS/nim_status_client
Identifier:            im.Status.NimStatusClient
Version:               1.0.0 (???)
Code Type:             X86-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2024-06-17 12:46:04.4758 +0100
OS Version:            macOS 13.6.7 (22G720)
Report Version:        12
Bridge OS Version:     8.5 (21P5077)
Anonymous UUID:        5A658639-5B56-59EC-5890-9183FBDEB115

Sleep/Wake UUID:       D77DCF29-7438-4E35-BE62-8F1427CA292E

Time Awake Since Boot: 3900 seconds
Time Since Wake:       143 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Codes:       0x0000000000000001, 0x0000000000000000

VM Region Info: 0 is not in any region.  Bytes before following region: 4500475904
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      10c3fd000-10d281000    [ 14.5M] r-x/r-x SM=COW  ...status_client

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libkeycard.dylib              	       0x10f5f3a52 0x10f5dc000 + 96850
1   libkeycard.dylib              	       0x10f5f3e28 0x10f5dc000 + 97832
2   libkeycard.dylib              	       0x10f5ec2df 0x10f5dc000 + 66271
3   libkeycard.dylib              	       0x10f5ec6a5 0x10f5dc000 + 67237
4   libkeycard.dylib              	       0x10f7490e8 crosscall2 + 1025512
5   libkeycard.dylib              	       0x10f74115c crosscall2 + 992860
6   libkeycard.dylib              	       0x10f749f59 crosscall2 + 1029209
7   libkeycard.dylib              	       0x10f74a25e crosscall2 + 1029982
8   libkeycard.dylib              	       0x10f5e3b13 0x10f5dc000 + 31507
9   libkeycard.dylib              	       0x10f5e37c5 0x10f5dc000 + 30661
10  libkeycard.dylib              	       0x10f646c49 _cgo_topofstack + 9289
11  libkeycard.dylib              	       0x10f6445ec 0x10f5dc000 + 427500
12  libkeycard.dylib              	       0x10f64eb3d crosscall2 + 61
13  libkeycard.dylib              	       0x10f74a77a KeycardInitFlow + 58
14  nim_status_client             	       0x10c5d1cdd 0x10c3fd000 + 1920221
15  nim_status_client             	       0x10c7674de 0x10c3fd000 + 3581150
16  nim_status_client             	       0x10cb66f72 0x10c3fd000 + 7774066
17  nim_status_client             	       0x10cb6ab11 0x10c3fd000 + 7789329
18  nim_status_client             	       0x10cbd97bb main + 59
19  dyld                          	    0x7ff81b8ea41f start + 1903
...

@siddarthkay
Copy link
Contributor

@Samyoul : Thanks for the report, this was also reported on the PR here #15194 (comment)

@anastasiyaig anastasiyaig changed the title Can't launch Status app on intel MacOS Can't launch Status app on Intel-based Mac Jun 18, 2024
@siddarthkay
Copy link
Contributor

Now that I have access to an x86_64 MacOS Host I've Investigated a bit further.

The crash happens in this function in status-go : MultiAccountGenerateAndDeriveAddresses
which exists here -> https://github.com/status-im/status-go/blob/1d1d6e3276b4890f553cb637164181230f7133d5/account/generator/generator.go#L163

stacktrace ->

fatal error: bad sweepgen in refill

goroutine 17 [running, locked to thread]:
runtime.throw({0x114969872?, 0x1c000c49d08?})
/usr/local/go/src/runtime/panic.go:1077 +0x5c fp=0x1c000c49cc0 sp=0x1c000c49c90 pc=0x112b9433c
runtime.(*mcache).refill(0x10be115b8, 0x80?)
/usr/local/go/src/runtime/mcache.go:157 +0x20d fp=0x1c000c49d00 sp=0x1c000c49cc0 pc=0x112b7270d
runtime.(*mcache).nextFree(0x10be115b8, 0x1b)
/usr/local/go/src/runtime/malloc.go:929 +0x85 fp=0x1c000c49d48 sp=0x1c000c49d00 pc=0x112b69365
runtime.mallocgc(0xa4, 0x0, 0x0)
/usr/local/go/src/runtime/malloc.go:1116 +0x448 fp=0x1c000c49db0 sp=0x1c000c49d48 pc=0x112b69928
runtime.rawstring(...)
/usr/local/go/src/runtime/string.go:267
runtime.gostring(0x0?)
/usr/local/go/src/runtime/string.go:323 +0x3e fp=0x1c000c49df0 sp=0x1c000c49db0 pc=0x112bc745e
main._Cfunc_GoString(...)
_cgo_gotypes.go:72
main.MultiAccountGenerateAndDeriveAddresses(0x0?)
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/vendor/status-go/build/bin/statusgo-lib/main.go:44 
+0x14 fp=0x1c000c49e10 sp=0x1c000c49df0 pc=0x114784514
_cgoexp_2cc8b9dd78ee_MultiAccountGenerateAndDeriveAddresses(0x7ff7b58acc90)
_cgo_gotypes.go:173 +0x1e fp=0x1c000c49e30 sp=0x1c000c49e10 pc=0x114786d1e
runtime.cgocallbackg1(0x114786d00, 0x1c000c49fe0?, 0x0)
/usr/local/go/src/runtime/cgocall.go:399 +0x2b3 fp=0x1c000c49f00 sp=0x1c000c49e30 pc=0x112b61053
runtime.cgocallbackg(0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/cgocall.go:315 +0x125 fp=0x1c000c49f90 sp=0x1c000c49f00 pc=0x112b60d05
runtime.cgocallbackg(0x114786d00, 0x7ff7b58acc90, 0x0)
<autogenerated>:1 +0x29 fp=0x1c000c49fb8 sp=0x1c000c49f90 pc=0x112bcd9c9
runtime.cgocallback(0x0, 0x0, 0x0)
/usr/local/go/src/runtime/asm_amd64.s:1035 +0xcc fp=0x1c000c49fe0 sp=0x1c000c49fb8 pc=0x112bcafac
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1650 +0x1 fp=0x1c000c49fe8 sp=0x1c000c49fe0 pc=0x112bcb1e1

Next steps would be to narrow down which line of code triggers this crash by pointing to a branch in status-go and decorating it with logs.

@fryorcraken
Copy link
Collaborator

You can run gdb quite easily too

@siddarthkay
Copy link
Contributor

According to the stacktrace SIGSEGV is thrown when KeycardInitFlow is called
KeycardInitFlow is present here -> https://github.com/status-im/status-keycard-go/blob/master/shared/main.go#L43

//export KeycardInitFlow
func KeycardInitFlow(storageDir *C.char) *C.char {
	var err error
	globalFlow, err = skg.NewFlow(C.GoString(storageDir))

	return retErr(err)
}

This makes sense for errors like this :

SIGSEGV: Illegal storage access. (Attempt to read from nil?)

To confirm my suspicion, I will add logs to KeycardInitFlow

@siddarthkay
Copy link
Contributor

siddarthkay commented Jul 1, 2024

After I commented out calls to KeycardInitFlow and keycardCancelFlow
The crash goes away and I am able to use the application on Intel Mac.

Screenshot 2024-07-01 at 1 35 52 PM

@jrainville
Copy link
Member

cc @saledjenic @igor-sirotin ^

@siddarthkay
Copy link
Contributor

cd4e7a1

i-write-nim-now

@saledjenic
Copy link
Contributor

@bitgamma please check this comment and let us know what you think?
Could it be because of the updated Go version? We're using Go1.21 now (you recall that there was some issue more than a year ago when we wanted to switch to a newer Go, but in the end we gave up because of the crash GuyLouis had back then and kept on Go1.20.4 I think), could that be related?

@siddarthkay
Copy link
Contributor

siddarthkay commented Jul 2, 2024

For what its worth : I have a branch at status-keycard-go where I upgraded go to 1.21 and am currently trying to figure out a fix for this crash -> https://github.com/status-im/status-keycard-go/commits/debug-intel-macos-crash/
The status-desktop PR that uses this branch is here -> #15194

@bitgamma
Copy link
Member

bitgamma commented Jul 2, 2024

@saledjenic I don't think it is the same problem since it was something with signal handling. SIGSEGV seems like something is trying to access a null pointer. Might it be that storageDir is not passed correctly or is still null when the function is invoked?

@siddarthkay
Copy link
Contributor

siddarthkay commented Jul 2, 2024

Okay I was able to get the crash to go away for KeycardInitFlow by skipping this log value here :
2414f9d#diff-908e65f356af59dab1310bd39380f2884e3a2867d92ec0c68ea0c07c80c6cf15R102

So most likely on nim side we need to do better when dealing with nil pointers we get from status-keycard-go

will resume tomorrow

@siddarthkay
Copy link
Contributor

Might it be that storageDir is not passed correctly

According to my logs StorageDir was set but the resulting path did not exist :

keycard - before skg.NewFlow(C.GoString(storageDir))
keycard - value of storageDir is -> 0x1025590f0
keycard - attempting to read filepath is 
/Users/siddarth/data/Status/data/keycard/pairings.json
keycard - error at os.ReadFile with path logged above is
 open /Users/siddarth/data/Status/data/keycard/pairings.json: no such file or directory
keycard - no error at newPairingStore and value of pairingStore is 
&{path:/Users/siddarth/data/Status/data/keycard/pairings.json values:map[]}

@siddarthkay
Copy link
Contributor

and for some reason this code path does not crash on arm64 macOS but only on amd64.
such is the x86 life :D

@siddarthkay
Copy link
Contributor

siddarthkay commented Jul 3, 2024

The issue is indeed some weird quirk of go for darwin amd64, but I would not spend more time in getting those issues fixed, they would indeed be fixed in go 1.24 or something even further.

For now I think this solution is good enough.
tl;dr -> don't execute flows that crash i.e keyCardInitFlow and keyCardCancelFlow on intel MacOS

diff --git a/src/app_service/service/keycard/service.nim b/src/app_service/service/keycard/service.nim
index 1d023d6ba2c..fd9ec993c9c 100644
--- a/src/app_service/service/keycard/service.nim
+++ b/src/app_service/service/keycard/service.nim
@@ -97,9 +97,13 @@ QtObject:
   proc init*(self: Service) =
     if self.doLogging:
       debug "init keycard using ", pairingsJson=status_const.KEYCARDPAIRINGDATAFILE
-    let initResp = keycard_go.keycardInitFlow(status_const.KEYCARDPAIRINGDATAFILE)
-    if self.doLogging:
-      debug "initialization response: ", initResp
+    # This code must not be executed on Darwin amd64
+    # since go 1.21 Intel macs are not able to handle nil cStrings from go
+    # resulting in bad flushGen 12 in prepareForSweep; sweepgen 0
+    if not (status_const.IS_MACOS and status_const.IS_INTEL):
+      let initResp = keycard_go.keycardInitFlow(status_const.KEYCARDPAIRINGDATAFILE)
+      if self.doLogging:
+        debug "initialization response: ", initResp
 
   proc processSignal(self: Service, signal: string) =
     var jsonSignal: JsonNode
@@ -174,10 +178,14 @@ QtObject:
   proc cancelCurrentFlow*(self: Service) =
     if self.busy:
       return
-    let response = keycard_go.keycardCancelFlow()
-    self.currentFlow = KCSFlowType.NoFlow
-    if self.doLogging:
-      debug "keycardCancelFlow", kcServiceCurrFlow=($self.currentFlow), response=response
+    # This code must not be executed on Darwin amd64
+    # since go 1.21 Intel macs are not able to handle nil cStrings from go
+    # resulting in bad flushGen 12 in prepareForSweep; sweepgen 0
+    if not (status_const.IS_MACOS and status_const.IS_INTEL):
+      let response = keycard_go.keycardCancelFlow()
+      self.currentFlow = KCSFlowType.NoFlow
+      if self.doLogging:
+        debug "keycardCancelFlow", kcServiceCurrFlow=($self.currentFlow), response=response
 
   ##########################################################
   ## Used in test env only, for testing keycard flows
@@ -488,4 +496,4 @@ QtObject:
       error "registerForKeycardAvailability can be called only when keycard is busy"
       return
     self.registeredCallback = p
-    self.runTimer(CheckKeycardAvailabilityInterval, $TimerReason.WaitForKeycardAvailability)
\ No newline at end of file
+    self.runTimer(CheckKeycardAvailabilityInterval, $TimerReason.WaitForKeycardAvailability)
diff --git a/src/constants.nim b/src/constants.nim
index b6beddd9ae1..aa7eaadaa50 100644
--- a/src/constants.nim
+++ b/src/constants.nim
@@ -3,6 +3,7 @@ include env_cli_vars
 ## Added a constant here cause it's easier to check the app how it behaves
 ## on other platform if we just change the value here
 const IS_MACOS* = defined(macosx)
+const IS_INTEL* = defined(amd64)
 # For future supporting fingerprints on other platforms
 const SUPPORTS_FINGERPRINT* = IS_MACOS
 # This is changed during compilation by reading the VERSION file

@siddarthkay
Copy link
Contributor

I've tried to make a minimal crash reproduction here https://github.com/siddarthkay/status-desktop-intel-crash-reproducer
I would appreciate @status-im/desktop-core-team to please correct my assumptions if any and lend any help you can.

Thank you

@siddarthkay
Copy link
Contributor

another discovery worth mentioning is that after enabling debug symbols I see SIGSEV happening at : openAccounts
in the nim wrapper of status-go

siddarth@maci7-01 MacOS % sudo ./nim_status_client --datadir=~/data/Status --LOG_LEVEL=DEBUG
INFO [07-08|04:34:13.887] Status backend initialized               backend=geth version= commit=0c470854e IpfsGatewayURL=https://ipfs.status.im/
INF 2024-07-08 05:34:14.566+01:00 Version: 0.9.90                            topics="status-app" tid=225481244 file=nim_status_client.nim:206
INF 2024-07-08 05:34:14.566+01:00 Commit: 58d9d547b                          topics="status-app" tid=225481244 file=nim_status_client.nim:207
INF 2024-07-08 05:34:14.567+01:00 Current date:                              topics="status-app" tid=225481244 file=nim_status_client.nim:208 currentDateTime=2024-07-08T05:34:14+01:00
INF 2024-07-08 05:34:14.567+01:00 starting application controller...         topics="status-app" tid=225481244 file=nim_status_client.nim:210
before calling keycardInitFlow
keycard - before skg.NewFlow(C.GoString(storageDir))
keycard - value of storageDir is -> 0x10f05a0f0
keycard - error is <nil>
after calling keycardInitFlow
funcOut is not Nil in keycardInitFlow
returning response for keycardInitFlow ->ok
after feeeing memory in keycardInitFlow
Traceback (most recent call last)
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/nim_status_client.nim(217) nim_status_client
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/nim_status_client.nim(211) mainProc
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/app/boot/app_controller.nim(414) start
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/app/modules/startup/io_interface.nim(26) load
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/app/modules/startup/module.nim(121) load
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/app/modules/startup/controller.nim(190) shouldStartWithOnboardingScreen
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/app_service/service/accounts/service.nim(131) openedAccounts
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/src/backend/accounts.nim(263) openedAccounts
/Users/jenkins/workspace/rs_macos_x86_64_package_PR-15194/vendor/nim-status-go/status_go.nim(25) openAccounts
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
zsh: segmentation fault  sudo ./nim_status_client --datadir=~/data/Status --LOG_LEVEL=DEBUG

@siddarthkay
Copy link
Contributor

I did find a status-go test which calls openAccounts
and it runs fine on my Arm MacOS

[nix-shell:~/gopath/src/github.com/status-im/status-go/api]$ go test -run TestLoginAndMigrationsStillWorkWithExistingDesktopUser
INFO [07-08|07:27:26.368|github.com/status-im/status-go/api/geth_backend.go:110] Status backend initialized               backend=geth version= commit= IpfsGatewayURL=
PASS
ok      github.com/status-im/status-go/api      7.243s

Same test on intel MacOS fails :

[nix-shell:~/Desktop/crashtest/status-go/api]$ go test -run TestLoginAndMigrationsStillWorkWithExistingDesktopUser
# github.com/rjeczalik/notify
In file included from ../vendor/github.com/rjeczalik/notify/watcher_fsevents_cgo.go:11:
In file included from /nix/store/rc2mfzjdfnhfm8grc4zi0p85m4k7rj7k-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39:
In file included from /nix/store/rc2mfzjdfnhfm8grc4zi0p85m4k7rj7k-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:23:
In file included from /nix/store/rc2mfzjdfnhfm8grc4zi0p85m4k7rj7k-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23:
In file included from /nix/store/rc2mfzjdfnhfm8grc4zi0p85m4k7rj7k-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:29:
In file included from /nix/store/rc2mfzjdfnhfm8grc4zi0p85m4k7rj7k-apple-framework-CoreServices-11.0.0/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43:
In file included from /nix/store/ggzvbag576nnphvr1y5869yx26m0kr82-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/Security.h:87:
/nix/store/ggzvbag576nnphvr1y5869yx26m0kr82-apple-framework-Security-11.0.0/Library/Frameworks/Security.framework/Headers/SecCode.h:35:10: fatal error: 'xpc/xpc.h' file not found
#include <xpc/xpc.h>
         ^~~~~~~~~~~
1 error generated.
FAIL	github.com/status-im/status-go/api [build failed]

@siddarthkay
Copy link
Contributor

I found yet another solution to the crash problem.

For me crashes went away after I introduced minor sleep time before calling status-go methods that would crash. I've limited the sleep code only to Intel MacOS to avoid any slowdowns on arm MacOS.

ref -> 492d73e

I think this would solution is definitely better than commenting our or skipping any keycard flows.

@jrainville
Copy link
Member

I found yet another solution to the crash problem.

For me crashes went away after I introduced minor sleep time before calling status-go methods that would crash. I've limited the sleep code only to Intel MacOS to avoid any slowdowns on arm MacOS.

ref -> 492d73e

I think this would solution is definitely better than commenting our or skipping any keycard flows.

I think it can be a good stop gap until we find a better solution.

My only concert is if that 300ms is enough for all machines. I assume this is a race condition, so we need to be sure that it's not on the edge where some people will crash

@siddarthkay
Copy link
Contributor

@jrainville you're right. I intend to play with this number further. When testing with @qoqobolo she was able to reproduce the crash once but then it worked for her afterwards. Maybe 500 milliseconds is a good safety measure. Will continue tomorrow 👋

@jrainville
Copy link
Member

@siddarthkay we plan on cutting the release branch soon. We can always add your fix to the release branch afterwards, but I just wanted to check if maybe there was a stop gap we could merge for now?

@siddarthkay
Copy link
Contributor

@jrainville : I think a good enough solution for now would be to check and merge the sleep solution in this PR -> #15194 and we should then open another issue to further investigate the race conditions on intel MacOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash infra-team macos
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.