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

Xcode 14.3 (clang 14.0.3) crash on alloc_slab.cpp #8233

Open
dabaicaifen opened this issue May 11, 2023 · 11 comments
Open

Xcode 14.3 (clang 14.0.3) crash on alloc_slab.cpp #8233

dabaicaifen opened this issue May 11, 2023 · 11 comments

Comments

@dabaicaifen
Copy link

How frequently does the bug occur?

Always

Description

I recently upgraded to Xcode 14.3 and our application always failed at Xcode analyze task.

I can reproduce the issue with a fresh new project, just add Realm references, and run Analyze from Xcode.

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

Run Analyze from Xcode.

Version

10.38.3

What Atlas Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

16.4

Build environment

Xcode version: 14.3
Dependency manager and version: 10.38.3

@dianaafanador3
Copy link
Contributor

Hi @dabaicaifen I was able to reproduce your issue on my local and it seems like your finding are correct. I'm generating a report with the issues which may be causing this to happen, and try to solve them.

@tgoyne
Copy link
Member

tgoyne commented May 25, 2023

I've occasionally run the clang static analyzer on our code and it's generally just been a mix of false positives and irrelevant things, so we've never set it as a goal to get zero warnings from it. It looks like there's currently a few very minor correct things and a bunch of incorrect things.

@dabaicaifen
Copy link
Author

Any update?

@dianaafanador3
Copy link
Contributor

@dabaicaifen There are a couple of PR (#8249 and realm/realm-core#6675) which solve some of the warnings

@tgoyne
Copy link
Member

tgoyne commented Jul 25, 2023

While there are a handful of static analyzer warnings, they are very unlikely to be related to a crash in alloc_slab and we will need details about the actual problem you are hitting to be able to do anything.

@dabaicaifen
Copy link
Author

While there are a handful of static analyzer warnings, they are very unlikely to be related to a crash in alloc_slab and we will need details about the actual problem you are hitting to be able to do anything.

I can easily reproduce the crash with a fresh new project, have you tried it? @tgoyne

@leemaguire
Copy link
Contributor

@dabaicaifen Could you send us a sample app that reproduces this issue?

@tgoyne
Copy link
Member

tgoyne commented Jul 26, 2023

We do indeed have tests and they don't crash.

@dabaicaifen
Copy link
Author

We do indeed have tests and they don't crash.

@tgoyne please use this demo https://github.com/dabaicaifen/RealmDemo/tree/analyze-crash, the branch is analyze-crash. And use Xcode 14.3 or 14.3.1.

@laud
Copy link

laud commented Aug 2, 2023

I can confirm that this issue exists and continues to be a thorn when using Realm. The warnings are not the problem, but rather a segmentation fault on alloc_slab.cpp.

Here's a stack trace of the issue on my local machine:

Analyze /Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/SourcePackages/checkouts/realm-core/src/realm/alloc_slab.cpp normal arm64 (in target 'RealmCore' from project 'RealmDatabase')
    cd /Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/SourcePackages/checkouts/realm-core
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -ivfsstatcache /Users/daniel/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator16.4-20E238-.sdkstatcache -target arm64-apple-ios11.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=c++17 -fmodules -gmodules -fmodules-cache-path\=/Users/daniel/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/daniel/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -fmodule-name\=RealmCore -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DSWIFT_PACKAGE -DDEBUG\=1 -DREALM_DEBUG -DREALM_NO_CONFIG -DREALM_INSTALL_LIBEXECDIR\= -DREALM_ENABLE_ASSERTIONS\=1 -DREALM_ENABLE_ENCRYPTION\=1 -DREALM_ENABLE_SYNC\=1 -DREALM_ENABLE_GEOSPATIAL\=0 -DREALM_VERSION_MAJOR\=13 -DREALM_VERSION_MINOR\=17 -DREALM_VERSION_PATCH\=1 -DREALM_VERSION_EXTRA\=\"\" -DREALM_VERSION_STRING\=\"13.17.1\" -DREALM_HAVE_SECURE_TRANSPORT\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -D__clang_analyzer__ -Xclang -analyzer-output\=plist-multi-file -Xclang -analyzer-config -Xclang report-in-main-source-file\=true -Xclang -analyzer-config -Xclang nullability:NoDiagnoseCallsToSystemHeaders\=true -Xclang -analyzer-checker -Xclang security.insecureAPI.UncheckedReturn -Xclang -analyzer-checker -Xclang security.insecureAPI.getpw -Xclang -analyzer-checker -Xclang security.insecureAPI.gets -Xclang -analyzer-checker -Xclang security.insecureAPI.mkstemp -Xclang -analyzer-checker -Xclang security.insecureAPI.mktemp -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.rand -Xclang -analyzer-disable-checker -Xclang security.insecureAPI.strcpy -Xclang -analyzer-checker -Xclang security.insecureAPI.vfork -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/SourcePackages/checkouts/realm-core/src/external/IntelRDFPMathLib20U2/LIBRARY/src -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Products/Debug-iphonesimulator/include -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/SourcePackages/checkouts/realm-core/src -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/SourcePackages/checkouts/realm-core/src/external -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/SourcePackages/checkouts/realm-core/src -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Intermediates.noindex/RealmDatabase.build/Debug-iphonesimulator/RealmCore.build/DerivedSources-normal/arm64 -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Intermediates.noindex/RealmDatabase.build/Debug-iphonesimulator/RealmCore.build/DerivedSources/arm64 -I/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Intermediates.noindex/RealmDatabase.build/Debug-iphonesimulator/RealmCore.build/DerivedSources -F/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Products/Debug-iphonesimulator/PackageFrameworks -F/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Products/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Frameworks -iframework /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.4.sdk/Developer/Library/Frameworks -fmodule-map-file\=/Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Intermediates.noindex/GeneratedModuleMaps-iphonesimulator/Bid.modulemap -DXcode -MMD -MT dependencies -MF /Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Intermediates.noindex/RealmDatabase.build/Debug-iphonesimulator/RealmCore.build/StaticAnalyzer/RealmDatabase/RealmCore/normal/arm64/alloc_slab.d --analyze /Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/SourcePackages/checkouts/realm-core/src/realm/alloc_slab.cpp -o /Users/daniel/Library/Developer/Xcode/DerivedData/Dedupe-agmuulpzqfztnhhawthmaxautyvs/Build/Intermediates.noindex/RealmDatabase.build/Debug-iphonesimulator/RealmCore.build/StaticAnalyzer/RealmDatabase/RealmCore/normal/arm64/alloc_slab.plist

clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-ios11.0-simulator
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/2m/3v9gxmxn5pjdpnd1tljpdffh0000gq/T/alloc_slab-ba8761.cpp
clang: note: diagnostic msg: /var/folders/2m/3v9gxmxn5pjdpnd1tljpdffh0000gq/T/alloc_slab-ba8761.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/daniel/Library/Logs/DiagnosticReports/clang_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg: 

********************
Command Analyze failed with a nonzero exit code

@sync-by-unito sync-by-unito bot removed the T-Bug label Sep 12, 2023
@woin2ee
Copy link
Contributor

woin2ee commented Sep 14, 2023

Are there any solutions I can apply now?

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

No branches or pull requests

6 participants