getsentry / sentry-native

Sentry SDK for C, C++ and native applications.
MIT License
378 stars 164 forks source link

install issue #970

Closed Cherkah closed 3 months ago

Cherkah commented 3 months ago

Description probleme during buld on archlinux + KDE plasma6

Environment

Steps To Reproduce pacman -S sentry-native

Log output

[ 99%] Building C object tests/unit/CMakeFiles/sentry_fuzz_json.dir/__/__/vendor/stb_sprintf.c.o
[100%] Building C object tests/unit/CMakeFiles/sentry_fuzz_json.dir/fuzz.c.o
[100%] Linking CXX executable sentry_fuzz_json
[100%] Built target sentry_fuzz_json
==> Lancement de check()…
=============================================== test session starts ================================================
platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/sagitarius/.cache/yay/sentry-native/src/sentry-native
plugins: pytest_httpserver-1.0.10
collected 324 items                                                                                                

tests/test_build_static.py ...                                                                               [  0%]
tests/test_integration_crashpad.py .FssssssFFF..sF.                                                          [  5%]
tests/test_integration_http.py .........F....                                                                [ 10%]
tests/test_integration_ratelimits.py ...                                                                     [ 11%]
tests/test_integration_stdout.py ........FF..                                                                [ 14%]
tests/test_unit.py ......................................................................................... [ 42%]
............................................................................................................ [ 75%]
...............................................................................                              [100%]

===================================================== FAILURES =====================================================
_____________________________________________ test_crashpad_reinstall ______________________________________________

/usr/lib/python3.11/site-packages/pytest_httpserver/httpserver.py:1331: AssertionError
----------------------------------------------- Captured stderr call -----------------------------------------------
[sentry] INFO using database path "/tmp/pytest-of-sagitarius/pytest-0/cmake3/.sentry-native"
[sentry] DEBUG starting transport
[sentry] DEBUG starting background worker thread
[sentry] DEBUG starting backend
[sentry] DEBUG starting crashpad backend with handler "/tmp/pytest-of-sagitarius/pytest-0/cmake3/crashpad_handler"
[sentry] DEBUG background worker thread started
[sentry] DEBUG using minidump URL "http://127.0.0.1:33159/api/123456/minidump/?sentry_client=sentry.native/0.7.1&sentry_key=uiaeosnrtdy"
[sentry] INFO started crashpad client handler
[sentry] DEBUG processing and pruning old runs
[sentry] DEBUG merging scope into event
[sentry] DEBUG trying to read modules from /proc/self/maps
[sentry] DEBUG read 29 modules from /proc/self/maps
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] DEBUG executing task on worker thread
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
*   Trying 127.0.0.1:33159...
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
* Connected to 127.0.0.1 (127.0.0.1) port 33159
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
> POST /api/123456/envelope/ HTTP/1.1
Host: 127.0.0.1:33159
User-Agent: sentry.native/0.7.1
Accept: */*
x-sentry-auth:Sentry sentry_key=uiaeosnrtdy, sentry_version=7, sentry_client=sentry.native/0.7.1
content-type:application/x-sentry-envelope
content-length:7314

[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] DEBUG merging scope into event
[sentry] DEBUG adding attachments to envelope
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] INFO flushing session and queue before crashpad handler
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG serializing envelope into buffer
[sentry] DEBUG dumped 10 in-flight envelopes to disk
[sentry] INFO handing control over to crashpad
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: Werkzeug/2.3.8 Python/3.11.8
< Date: Sat, 23 Mar 2024 20:35:18 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 2
< Connection: close
< 
OK* Closing connection
[14044:14044:20240323,213518.333990:WARNING exception_handler_server.cc:204] no ptrace
------------------------------------------------ Captured log call -------------------------------------------------
INFO     werkzeug:_internal.py:187 127.0.0.1 - - [23/Mar/2024 21:35:18] "POST /api/123456/envelope/ HTTP/1.1" 200 -
_____________________________________________ test_breakpad_crash_http _____________________________________________

cmake = <bound method CMake.compile of <tests.cmake.CMake object at 0x785fc9dca7d0>>
httpserver = <HTTPServer host=localhost port=33159>

@pytest.mark.skipif(not has_breakpad, reason="test needs breakpad backend")
def test_breakpad_crash_http(cmake, httpserver):
tmp_path = cmake(["sentry_example"], {"SENTRY_BACKEND": "breakpad"})

httpserver.expect_request(
"/api/123456/envelope/",
headers={"x-sentry-auth": auth_header},
).respond_with_data("OK")
env = dict(os.environ, SENTRY_DSN=make_dsn(httpserver))

child = run(
tmp_path,
"sentry_example",
["log", "start-session", "attachment", "crash"],
env=env,
)
assert child.returncode  # well, it's a crash after all

run(
tmp_path,
"sentry_example",
["log", "no-setup"],
check=True,
env=env,
)

assert len(httpserver.log) == 1
envelope = Envelope.deserialize(httpserver.log[0][0].get_data())

assert_session(envelope, {"init": True, "status": "crashed", "errors": 1})

assert_meta(envelope, integration="breakpad")
assert_breadcrumb(envelope)
assert_attachment(envelope)

assert_breakpad_crash(envelope)
>       assert_minidump(envelope)

tests/test_integration_http.py:355: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

envelope = <Envelope headers={'dsn': 'http://uiaeosnrtdy@127.0.0.1:33159/123456', 'event_id': '0294f5f4-1437-493c-43c0-e314963220...3-23T20:35:55.335Z', 'duration': 0.003, 'attrs': {'release': 'test-example-release', 'environment': 'development'}}>>]>

def assert_minidump(envelope):
expected = {
"type": "attachment",
"attachment_type": "event.minidump",
}
>       minidump = next(item for item in envelope if matches(item.headers, expected))
E       StopIteration

tests/assertions.py:183: StopIteration

The above exception was the direct cause of the following exception:

cls = <class '_pytest.runner.CallInfo'>, func = <function call_and_report.<locals>.<lambda> at 0x785fc9f33a60>
when = 'call', reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
"""Call func, wrapping the result in a CallInfo.

:param func:
The function to call. Called without arguments.
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
>           result: Optional[TResult] = func()

/usr/lib/python3.11/site-packages/_pytest/runner.py:340: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.11/site-packages/_pytest/runner.py:240: in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.11/site-packages/pluggy/_hooks.py:501: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/usr/lib/python3.11/site-packages/pluggy/_manager.py:119: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_call
yield from thread_exception_runtest_hook()
/usr/lib/python3.11/site-packages/_pytest/threadexception.py:63: in thread_exception_runtest_hook
yield
/usr/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
/usr/lib/python3.11/site-packages/_pytest/unraisableexception.py:65: in unraisable_exception_runtest_hook
yield
/usr/lib/python3.11/site-packages/_pytest/logging.py:849: in pytest_runtest_call
yield from self._runtest_for(item, "call")
/usr/lib/python3.11/site-packages/_pytest/logging.py:832: in _runtest_for
yield
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <CaptureManager _method='fd' _global_capturing=<MultiCapture out=<FDCapture 1 oldfd=6 _state='suspended' tmpfile=<_io....xtIOWrapper name='/dev/null' mode='r' encoding='utf-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>
item = <Function test_breakpad_crash_http>

@hookimpl(wrapper=True)
def pytest_runtest_call(self, item: Item) -> Generator[None, None, None]:
with self.item_capture("call", item):
>           return (yield)
E           RuntimeError: generator raised StopIteration

/usr/lib/python3.11/site-packages/_pytest/capture.py:883: RuntimeError
----------------------------------------------- Captured stdout call -----------------------------------------------

/tmp/pytest-of-sagitarius/pytest-0/cmake6 > cmake -DSENTRY_BACKEND=breakpad -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/tmp/pytest-of-sagitarius/pytest-0/cmake6 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=/tmp/pytest-of-sagitarius/pytest-0/cmake6 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=/tmp/pytest-of-sagitarius/pytest-0/cmake6 /home/sagitarius/.cache/yay/sentry-native/src/sentry-native
-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- SENTRY_TRANSPORT=curl
-- SENTRY_BACKEND=breakpad
-- SENTRY_LIBRARY_TYPE=SHARED
-- SENTRY_SDK_NAME=
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long
-- Check size of long - done
-- Found CURL: /usr/lib/libcurl.so (found version "8.6.0") found components: AsynchDNS
-- Looking for getcontext
-- Looking for getcontext - found
-- Configuring done (1.4s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/pytest-of-sagitarius/pytest-0/cmake6
/tmp/pytest-of-sagitarius/pytest-0/cmake6 > cmake --build . --target sentry_example --parallel
[  0%] Building CXX object external/CMakeFiles/breakpad_client.dir/breakpad/src/common/string_conversion.cc.o
[  2%] Building CXX object external/CMakeFiles/breakpad_client.dir/breakpad/src/common/linux/elf_core_dump.cc.o
[  2%] Building CXX object external/CMakeFiles/breakpad_client.dir/breakpad/src/common/linux/
[100%] Built target sentry_example
----------------------------------------------- Captured stderr call -----------------------------------------------
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG
CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE

Dans la fonction « trigger_crash »,
mis en ligne depuis « main » à /home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:422:9:
/home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:161:5: attention: « memset » écrire 100 octet dans une région de taille 0 déborde de la destination [-Wstringop-overflow=]
161 |     memset((char *)invalid_mem, 1, 100);
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dans la fonction « main »:
cc1: note: l'objet de destination est probablement à l'adresse zéro
Dans la fonction « trigger_crash »,
mis en ligne depuis « main » à /home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:323:9:
/home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:161:5: attention: « memset » écrire 100 octet dans une région de taille 0 déborde de la destination [-Wstringop-overflow=]
161 |     memset((char *)invalid_mem, 1, 100);
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dans la fonction « main »:
cc1: note: l'objet de destination est probablement à l'adresse zéro
[sentry] INFO using database path "/tmp/pytest-of-sagitarius/pytest-0/cmake6/.sentry-native"
[sentry] DEBUG starting transport
[sentry] DEBUG starting background worker thread
[sentry] DEBUG starting backend
[sentry] DEBUG processing and pruning old runs
[sentry] DEBUG background worker thread started
[sentry] INFO entering breakpad minidump callback
[sentry] DEBUG merging scope into event
[sentry] DEBUG trying to read modules from /proc/self/maps
[sentry] DEBUG read 29 modules from /proc/self/maps
[sentry] DEBUG adding attachments to envelope
[sentry] WARN failed to read envelope item from "/tmp/pytest-of-sagitarius/pytest-0/cmake6/.sentry-native/8a591981-18ee-4240-a66f-968224fe5984.run/ead0c3f4-24ad-465e-83dc1eb1-97c28ea7.dmp"
[sentry] DEBUG sending envelope
[sentry] DEBUG serializing envelope into buffer
[sentry] INFO crash has been captured
[sentry] INFO using database path "/tmp/pytest-of-sagitarius/pytest-0/cmake6/.sentry-native"
[sentry] DEBUG starting transport
[sentry] DEBUG starting background worker thread
[sentry] DEBUG starting backend
[sentry] DEBUG processing and pruning old runs
[sentry] DEBUG background worker thread started
[sentry] DEBUG sending envelope
[sentry] DEBUG submitting task to background worker thread
[sentry] DEBUG executing task on worker thread
[sentry] DEBUG shutting down backend
[sentry] DEBUG shutting down transport
[sentry] DEBUG shutting down background worker thread
[sentry] DEBUG submitting task to background worker thread
*   Trying 127.0.0.1:33159...
* Connected to 127.0.0.1 (127.0.0.1) port 33159
> POST /api/123456/envelope/ HTTP/1.1
Host: 127.0.0.1:33159
User-Agent: sentry.native/0.7.1
Accept: */*
x-sentry-auth:Sentry sentry_key=uiaeosnrtdy, sentry_version=7, sentry_client=sentry.native/0.7.1
content-type:application/x-sentry-envelope
content-length:32338

* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: Werkzeug/2.3.8 Python/3.11.8
< Date: Sat, 23 Mar 2024 20:35:55 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 2
< Connection: close
< 
OK* Closing connection
[sentry] DEBUG executing task on worker thread
[sentry] DEBUG background worker thread shut down
------------------------------------------------ Captured log call -------------------------------------------------
INFO     werkzeug:_internal.py:187 127.0.0.1 - - [23/Mar/2024 21:35:55] "POST /api/123456/envelope/ HTTP/1.1" 200 -
____________________________________________ test_breakpad_crash_stdout ____________________________________________

cmake = <bound method CMake.compile of <tests.cmake.CMake object at 0x785fc9dca7d0>>

@pytest.mark.skipif(not has_breakpad, reason="test needs breakpad backend")
def test_breakpad_crash_stdout(cmake):
tmp_path, output = run_crash_stdout_for("breakpad", cmake, [])

envelope = Envelope.deserialize(output)

assert_crash_timestamp(has_files, tmp_path)
assert_meta(envelope, integration="breakpad")
assert_breadcrumb(envelope)
assert_attachment(envelope)
>       assert_minidump(envelope)

tests/test_integration_stdout.py:211: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

envelope = <Envelope headers={'event_id': 'de246c50-7b5f-4b31-e3a8-12ac03f7c3d9'} items=[<Item headers={'type': 'event', 'length'.../CMAKE_INSTALL_PREFIX during last run\n_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX:INTERNAL=/usr/local\n\n" json=None>>]>

def assert_minidump(envelope):
expected = {
"type": "attachment",
"attachment_type": "event.minidump",
}
>       minidump = next(item for item in envelope if matches(item.headers, expected))
E       StopIteration

tests/assertions.py:183: StopIteration

The above exception was the direct cause of the following exception:

cls = <class '_pytest.runner.CallInfo'>, func = <function call_and_report.<locals>.<lambda> at 0x785fca0ac360>
when = 'call', reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
"""Call func, wrapping the result in a CallInfo.

:param func:
The function to call. Called without arguments.
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
>           result: Optional[TResult] = func()

/usr/lib/python3.11/site-packages/_pytest/runner.py:340: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.11/site-packages/_pytest/runner.py:240: in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.11/site-packages/pluggy/_hooks.py:501: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/usr/lib/python3.11/site-packages/pluggy/_manager.py:119: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_call
yield from thread_exception_runtest_hook()
/usr/lib/python3.11/site-packages/_pytest/threadexception.py:63: in thread_exception_runtest_hook
yield
/usr/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
/usr/lib/python3.11/site-packages/_pytest/unraisableexception.py:65: in unraisable_exception_runtest_hook
yield
/usr/lib/python3.11/site-packages/_pytest/logging.py:849: in pytest_runtest_call
yield from self._runtest_for(item, "call")
/usr/lib/python3.11/site-packages/_pytest/logging.py:832: in _runtest_for
yield
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <CaptureManager _method='fd' _global_capturing=<MultiCapture out=<FDCapture 1 oldfd=6 _state='suspended' tmpfile=<_io....xtIOWrapper name='/dev/null' mode='r' encoding='utf-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>
item = <Function test_breakpad_crash_stdout>

@hookimpl(wrapper=True)
def pytest_runtest_call(self, item: Item) -> Generator[None, None, None]:
with self.item_capture("call", item):
>           return (yield)
E           RuntimeError: generator raised StopIteration

/usr/lib/python3.11/site-packages/_pytest/capture.py:883: RuntimeError
----------------------------------------------- Captured stdout call -----------------------------------------------

/tmp/pytest-of-sagitarius/pytest-0/cmake10 > cmake -DSENTRY_BACKEND=breakpad -DSENTRY_TRANSPORT=none -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=/tmp/pytest-of-sagitarius/pytest-0/cmake10 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG=/tmp/pytest-of-sagitarius/pytest-0/cmake10 -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=/tmp/pytest-of-sagitarius/pytest-0/cmake10 /home/sagitarius/.cache/yay/sentry-native/src/sentry-native
-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- SENTRY_TRANSPORT=none
-- SENTRY_BACKEND=breakpad
-- SENTRY_LIBRARY_TYPE=SHARED
-- SENTRY_SDK_NAME=
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long
-- Check size of long - done
-- Looking for getcontext
-- Looking for getcontext - found
-- Configuring done (1.3s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/pytest-of-sagitarius/pytest-0/cmake10
/tmp/pytest-of-sagitarius/pytest-0/cmake10 > cmake --build . --target sentry_example --parallel
[  0%] Building CXX object external/CMakeFiles/breakpad_client.dir/breakpad/src/common/string_conversion.cc.o
[  0%] Building CXX object external/CMakeFiles/breakpad_client.dir/breakpad/src/common/
....
[100%] Built target sentry_example
----------------------------------------------- Captured stderr call -----------------------------------------------
CMake Warning:
Manually-specified variables were not used by the project:

CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG
CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE

Dans la fonction « trigger_crash »,
mis en ligne depuis « main » à /home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:422:9:
/home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:161:5: attention: « memset » écrire 100 octet dans une région de taille 0 déborde de la destination [-Wstringop-overflow=]
161 |     memset((char *)invalid_mem, 1, 100);
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dans la fonction « main »:
cc1: note: l'objet de destination est probablement à l'adresse zéro
Dans la fonction « trigger_crash »,
mis en ligne depuis « main » à /home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:323:9:
/home/sagitarius/.cache/yay/sentry-native/src/sentry-native/examples/example.c:161:5: attention: « memset » écrire 100 octet dans une région de taille 0 déborde de la destination [-Wstringop-overflow=]
161 |     memset((char *)invalid_mem, 1, 100);
|     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dans la fonction « main »:
cc1: note: l'objet de destination est probablement à l'adresse zéro
______________________________________ test_breakpad_crash_stdout_before_send ______________________________________

cmake = <bound method CMake.compile of <tests.cmake.CMake object at 0x785fc9dca7d0>>

@pytest.mark.skipif(not has_breakpad, reason="test needs breakpad backend")
def test_breakpad_crash_stdout_before_send(cmake):
tmp_path, output = run_crash_stdout_for("breakpad", cmake, ["before-send"])

envelope = Envelope.deserialize(output)

assert_crash_timestamp(has_files, tmp_path)
assert_meta(envelope, integration="breakpad")
assert_breadcrumb(envelope)
assert_attachment(envelope)
>       assert_minidump(envelope)

tests/test_integration_stdout.py:225: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

envelope = <Envelope headers={'event_id': '6d5275a8-a686-4c54-cf95-a687e743d6a9'} items=[<Item headers={'type': 'event', 'length'.../CMAKE_INSTALL_PREFIX during last run\n_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX:INTERNAL=/usr/local\n\n" json=None>>]>

def assert_minidump(envelope):
expected = {
"type": "attachment",
"attachment_type": "event.minidump",
}
>       minidump = next(item for item in envelope if matches(item.headers, expected))
E       StopIteration

tests/assertions.py:183: StopIteration

The above exception was the direct cause of the following exception:

cls = <class '_pytest.runner.CallInfo'>, func = <function call_and_report.<locals>.<lambda> at 0x785fc9d08860>
when = 'call', reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
"""Call func, wrapping the result in a CallInfo.

:param func:
The function to call. Called without arguments.
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
>           result: Optional[TResult] = func()

/usr/lib/python3.11/site-packages/_pytest/runner.py:340: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.11/site-packages/_pytest/runner.py:240: in <lambda>
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.11/site-packages/pluggy/_hooks.py:501: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/usr/lib/python3.11/site-packages/pluggy/_manager.py:119: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_call
yield from thread_exception_runtest_hook()
/usr/lib/python3.11/site-packages/_pytest/threadexception.py:63: in thread_exception_runtest_hook
yield
/usr/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
/usr/lib/python3.11/site-packages/_pytest/unraisableexception.py:65: in unraisable_exception_runtest_hook
yield
/usr/lib/python3.11/site-packages/_pytest/logging.py:849: in pytest_runtest_call
yield from self._runtest_for(item, "call")
/usr/lib/python3.11/site-packages/_pytest/logging.py:832: in _runtest_for
yield
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <CaptureManager _method='fd' _global_capturing=<MultiCapture out=<FDCapture 1 oldfd=6 _state='suspended' tmpfile=<_io....xtIOWrapper name='/dev/null' mode='r' encoding='utf-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>
item = <Function test_breakpad_crash_stdout_before_send>

@hookimpl(wrapper=True)
def pytest_runtest_call(self, item: Item) -> Generator[None, None, None]:
with self.item_capture("call", item):
>           return (yield)
E           RuntimeError: generator raised StopIteration

/usr/lib/python3.11/site-packages/_pytest/capture.py:883: RuntimeError
============================================= short test summary info ==============================================
FAILED tests/test_integration_crashpad.py::test_crashpad_reinstall - AssertionError: Wait timeout occurred, but somehandlers left:
FAILED tests/test_integration_crashpad.py::test_crashpad_dumping_crash[run_args0] - AssertionError: Wait timeout occurred, but some handlers left:
FAILED tests/test_integration_crashpad.py::test_crashpad_dumping_crash[run_args1] - AssertionError: Wait timeout occurred, but some handlers left:
FAILED tests/test_integration_crashpad.py::test_crashpad_dumping_crash[run_args2] - AssertionError: Wait timeout occurred, but some handlers left:
FAILED tests/test_integration_crashpad.py::test_crashpad_dump_inflight - AssertionError: Wait timeout occurred, but some handlers left:
FAILED tests/test_integration_http.py::test_breakpad_crash_http - RuntimeError: generator raised StopIteration
FAILED tests/test_integration_stdout.py::test_breakpad_crash_stdout - RuntimeError: generator raised StopIteration
FAILED tests/test_integration_stdout.py::test_breakpad_crash_stdout_before_send - RuntimeError: generator raised StopIteration
=============================== 8 failed, 309 passed, 7 skipped in 234.31s (0:03:54) ===============================
==> ERREUR : Une erreur s’est produite dans check().
Abandon…
-> error making: sentry-native-exit status 4
-> Failed to install the following packages. Manual intervention is required:
sentry-native - exit status 4
supervacuus commented 3 months ago

Hi, @Cherkah. Thanks for the report. We do not officially maintain the AUR package for sentry-native. Please get in touch with the package maintainer directly.

I can see that crashpad logs the following:

[14044:14044:20240323,213518.333990:WARNING exception_handler_server.cc:204] no ptrace

and that means that your /proc/sys/kernel/yama/ptrace_scope is set to 3 ("no attach"). In that configuration, no process can attach to any other process, even if the to-be-monitored process defines a pid as its ptracer. This makes both breakpad and crashpad unable to create a minidump, which is why that assertion fails.

Cherkah commented 3 months ago

@supervacuus

that means that your /proc/sys/kernel/yama/ptrace_scope is set to 3 ("no attach")

it's strange because i have in my sysctl.conf kernel.yama.ptrace_scope = 2

anay way, i'm gonna report it right to the AUR packager

Thanks

supervacuus commented 3 months ago

it's strange because i have in my sysctl.conf kernel.yama.ptrace_scope = 2

In this case, ptrace-attach may also not be allowed because the handler process doesn't have the capability CAP_SYS_PTRACE, which it typically has when it is run as root.

Cherkah commented 3 months ago

ok i've defined kernel.yama.ptrace_scope = 1 then reinstall sentry-native without issue:

[100%] Built target sentry_fuzz_json
==> Lancement de check()…
=============================================== test session starts ================================================
platform linux -- Python 3.11.8, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/sagitarius/.cache/yay/sentry-native/src/sentry-native
plugins: pytest_httpserver-1.0.10
collected 324 items                                                                                                

tests/test_build_static.py ...                                                                               [  0%]
tests/test_integration_crashpad.py ..ssssss.....s..                                                          [  5%]
tests/test_integration_http.py ..............                                                                [ 10%]
tests/test_integration_ratelimits.py ...                                                                     [ 11%]
tests/test_integration_stdout.py ............                                                                [ 14%]
tests/test_unit.py ......................................................................................... [ 42%]
............................................................................................................ [ 75%]
...............................................................................                              [100%]

==================================== 317 passed, 7 skipped in 135.95s (0:02:15) ====================================

regards