asyncfuture icon indicating copy to clipboard operation
asyncfuture copied to clipboard

feature request: fsanitize=thread results?

Open Dushistov opened this issue 6 years ago • 4 comments

As newcomer I would like to see that testing with -fsanitize=thread have been done. In perfect world of course this should be part of CI, but not sure how much efforts this requires, because of you need compile Qt from source code with -fsanitize=thread flag.

So may be just mention in readme that such kind of testing was done for OS Z/compiler Y/Qt X and all tests are green?

Dushistov avatar Mar 02 '18 11:03 Dushistov

I did a quick search about the current status of sanitize_thread support in QT binary. I doubt its support due to this issue:

[QTBUG-37402] QMutex not recognized by thread sanitizer - Qt Bug Tracker https://bugreports.qt.io/browse/QTBUG-37402

According to the last comment, even the patched version of Qt still report race condition.

I have tested with Qt 5.10 and it also reports race in calling future.result() which should be a thread-safe function. I am not sure if the result really meaningful.

benlau avatar Mar 02 '18 18:03 benlau

SUMMARY: ThreadSanitizer: data race qfuture.h:157 in QFuture<int>::result() const

If QFuture::result() could not pass the test, AsyncFuture won't pass for sure. I may test with Qt 5.11 later.

benlau avatar Mar 02 '18 19:03 benlau

Strange enough, future.result uses QFutureInterface<T>::resultReference which uses QMutex, and with patch mentioned in QTBUG-37402 mutex should have been annotated. You build patched version of Qt with -fsanitize=thread under what OS/compiler?

Dushistov avatar Mar 02 '18 20:03 Dushistov

It is a undocumented feature. sanitizer could be enabled via qmake by

CONFIG += sanitizer sanitize_thread

I don't know how Qt handle it . But I am not going to build my own version of Qt to test it as it is very time consuming.

benlau avatar Mar 03 '18 02:03 benlau