diff --git a/src/app_service/service/keycard/service.nim b/src/app_service/service/keycard/service.nim index bc7e5dfe3e..86e19f097c 100644 --- a/src/app_service/service/keycard/service.nim +++ b/src/app_service/service/keycard/service.nim @@ -97,6 +97,11 @@ QtObject: proc init*(self: Service) = if self.doLogging: debug "init keycard using ", pairingsJson=status_const.KEYCARDPAIRINGDATAFILE + # Do not remove the sleep 700 + # This sleep prevents a crash on intel MacOS + # with errors like bad flushGen 12 in prepareForSweep; sweepgen 0 + if status_const.IS_MACOS and status_const.IS_INTEL: + sleep 700 let initResp = keycard_go.keycardInitFlow(status_const.KEYCARDPAIRINGDATAFILE) if self.doLogging: debug "initialization response: ", initResp @@ -170,8 +175,14 @@ QtObject: debug "keycardResumeFlow", kcServiceCurrFlow=($self.currentFlow), payload=payload, response=response proc cancelCurrentFlow*(self: Service) = + # Do not remove the sleep 700 + # This sleep prevents a crash on intel MacOS + # with errors like bad flushGen 12 in prepareForSweep; sweepgen 0 + if status_const.IS_MACOS and status_const.IS_INTEL: + sleep 700 let response = keycard_go.keycardCancelFlow() - sleep(200) + # sleep 200 is needed for cancel flow + sleep 200 self.currentFlow = KCSFlowType.NoFlow self.busy = false if self.doLogging: diff --git a/src/backend/accounts.nim b/src/backend/accounts.nim index 588b711050..43b1dc1d1a 100644 --- a/src/backend/accounts.nim +++ b/src/backend/accounts.nim @@ -5,6 +5,7 @@ import ../app_service/service/accounts/dto/login_request import ../app_service/service/accounts/dto/create_account_request import ../app_service/service/accounts/dto/restore_account_request import ./response_type +import ../constants as status_const import status_go @@ -263,6 +264,11 @@ proc openedAccounts*(path: string): RpcResponse[JsonNode] = let mixPanelAppId = getEnv("MIXPANEL_APP_ID") let mixPanelToken = getEnv("MIXPANEL_TOKEN") let payload = %* {"dataDir": path, "mixpanelAppId": mixPanelAppId, "mixpanelToken": mixPanelToken} + # Do not remove the sleep 700 + # This sleep prevents a crash on intel MacOS + # with errors like bad flushGen 12 in prepareForSweep; sweepgen 0 + if status_const.IS_MACOS and status_const.IS_INTEL: + sleep 700 let response = status_go.initializeApplication($payload) result.result = Json.decode(response, JsonNode) except RpcException as e: @@ -321,7 +327,7 @@ proc loginAccount*(request: LoginAccountRequest): RpcResponse[JsonNode] = let payload = request.toJson() let response = status_go.loginAccount($payload) result.result = Json.decode(response, JsonNode) - + except RpcException as e: error "loginAccount failed", exception=e.msg raise newException(RpcException, e.msg) diff --git a/src/constants.nim b/src/constants.nim index df8e32f190..a8671e1837 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