Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

clang-tidy `detach_promise`: dereference of a null pointer

24 views
Skip to first unread message

Łukasz Kurowski

<crackcomm@gmail.com>
unread,
Jan 12, 2025, 12:41:58 AMJan 12
to seastar-dev
Hello,

I am running clang-tidy on smf and I'm encountering this warning from clang-tidy which warns about possible nullptr dereference in future.hh `detach_promise` and I'm not sure if it's a false positive or an issue with my code and it will take me some time to understand.


It seems like a super edge case but it might be right, I don't know. Any help would be appreciated.

Thank you.

Avi Kivity

<avi@scylladb.com>
unread,
Jan 12, 2025, 4:49:28 AMJan 12
to Łukasz Kurowski, seastar-dev
The trace shows code that is not part of Seastar. Could it be that the code that calls out.close() does so despite it being already closed?
--
You received this message because you are subscribed to the Google Groups "seastar-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to seastar-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/seastar-dev/32c77dc7-d1c9-48d6-b502-cee60e15ce12n%40googlegroups.com.

Łukasz Kurowski

<crackcomm@gmail.com>
unread,
Jan 12, 2025, 5:46:57 AMJan 12
to Avi Kivity, seastar-dev
The gist has two separate log files, the first line contains a link to source code.

The trace in log2.log is from https://github.com/smfrpc/smf/blob/master/src/core/rpc_server.cc#L271 (line/position is different only because of clang-format).
It doesn't seem like there is any call to close in this case.

The fist trace - https://github.com/smfrpc/smf/blob/master/src/core/histogram_seastar_utils.cc#L33 - I suspected the issue is likely to be in this code - it uses `with_file_close_on_failure` and `out.close()` but only in `then` case so it shouldn't be called twice. I've rewritten this code using coroutines to make it easier to read. I still have no idea if there really was an issue in this code.

Łukasz Kurowski

<crackcomm@gmail.com>
unread,
Jan 12, 2025, 6:31:47 AMJan 12
to Avi Kivity, seastar-dev
Here is a result of running clang-tidy on future.cc: https://gist.github.com/crackcomm/9b4bfff59a3c6eecc4390ff1b218ba6c

Łukasz Kurowski

<crackcomm@gmail.com>
unread,
Jan 12, 2025, 6:52:49 AMJan 12
to Avi Kivity, seastar-dev
I added clang-tidy to seastar_bazel because I'm not sure how easy it is to run from seastar/CMake:

```
alias bazel=/tmp/bazel
bazel build --config=clang-tidy --keep_going @seastar//:core
```

Reply all
Reply to author
Forward
0 new messages