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

Lock: guarantee crash instead of undefined behaviour #1131

Merged
merged 4 commits into from Sep 9, 2019

Conversation

@weissi
Copy link
Member

commented Sep 6, 2019

Motivation:

NIO's Lock currently just deadlocks if a thread which already holds a
lock tries to reacquire it. This however isn't even really defined
behaviour.

Modifications:

Switch us to a guaranteed crash from a unguarnateed hang.

Result:

Easier to debug deadlocks with NIO's lock.

weissi added 3 commits Sep 6, 2019
Lock: guarantee crash instead of undefined behaviour
Motivation:

NIO's Lock currently just deadlocks if a thread which already holds a
lock tries to reacquire it. This however isn't even really defined
behaviour.

Modifications:

Switch us to a guaranteed crash from a unguarnateed hang.

Result:

Easier to debug deadlocks with NIO's lock.
@weissi

This comment has been minimized.

Copy link
Member Author

commented Sep 6, 2019

@swift-nio-bot test perf please

@swift-nio-bot

This comment has been minimized.

Copy link

commented Sep 6, 2019

performance report

build id: 15

timestamp: Fri Sep 6 15:49:07 UTC 2019

results

nameminmaxmeanstd
write_http_headers 0.004907965660095215 0.004938960075378418 0.004917895793914795 9.526812164245141e-06
bytebuffer_write_12MB_short_string_literals 0.4901740550994873 0.49808597564697266 0.49164170026779175 0.0023325763992403654
bytebuffer_write_12MB_short_calculated_strings 0.4851750135421753 0.48897600173950195 0.4864711046218872 0.0011872251616712494
bytebuffer_write_12MB_medium_string_literals 0.17349696159362793 0.17689096927642822 0.17525429725646974 0.0009774631428354267
bytebuffer_write_12MB_medium_calculated_strings 0.2363879680633545 0.2378990650177002 0.2371500015258789 0.00041931024126207607
bytebuffer_write_12MB_large_calculated_strings 0.2136319875717163 0.21507203578948975 0.2142964005470276 0.0004804287108506166
bytebuffer_lots_of_rw 0.5501660108566284 0.5533950328826904 0.5510208010673523 0.0009176831908381459
bytebuffer_write_http_response_ascii_only_as_string 0.03803408145904541 0.03872096538543701 0.03825398683547974 0.00023149725851516714
bytebuffer_write_http_response_ascii_only_as_staticstring 0.028766989707946777 0.02936708927154541 0.028921401500701903 0.0002306843740677141
bytebuffer_write_http_response_some_nonascii_as_string 0.0382000207901001 0.03902602195739746 0.038419902324676514 0.00025342317570018575
bytebuffer_write_http_response_some_nonascii_as_staticstring 0.02884805202484131 0.02941596508026123 0.028941404819488526 0.0001697906396506685
no-net_http1_10k_reqs_1_conn 0.14528703689575195 0.14625096321105957 0.14584839344024658 0.00032964618452514994
http1_10k_reqs_1_conn 0.5869979858398438 0.5917130708694458 0.5886618018150329 0.0015949940430325883
http1_10k_reqs_100_conns 0.5868170261383057 0.589913010597229 0.588367509841919 0.0010634337703569526
future_whenallsucceed_100k_immediately_succeeded_off_loop 0.11992490291595459 0.12259101867675781 0.12122578620910644 0.0007918578416815086
future_whenallsucceed_100k_immediately_succeeded_on_loop 0.12165200710296631 0.13246703147888184 0.12310531139373779 0.0033018145413359645
future_whenallsucceed_100k_deferred_off_loop 0.6176810264587402 0.6203960180282593 0.6194928169250489 0.0008393097807221061
future_whenallsucceed_100k_deferred_on_loop 0.19269108772277832 0.19482600688934326 0.19380581378936768 0.0008345689822339839
future_whenallcomplete_100k_immediately_succeeded_off_loop 0.10043501853942871 0.10213291645050049 0.10138758420944213 0.0004825078982205746
future_whenallcomplete_100k_immediately_succeeded_on_loop 0.10171198844909668 0.10306990146636963 0.1023062825202942 0.00043342915207108054
future_whenallcomplete_100k_deferred_off_loop 0.6007030010223389 0.6134260892868042 0.6075155973434448 0.003996686783794447
future_whenallcomplete_100k_deferred_on_loop 0.1768779754638672 0.18397700786590576 0.1786622166633606 0.0019719516386130015
future_reduce_10k_futures 0.047760009765625 0.048684000968933105 0.04827449321746826 0.00028152301081458555
future_reduce_into_10k_futures 0.047976016998291016 0.04865598678588867 0.04833430051803589 0.00022610743864139151
channel_pipeline_1m_events 0.21955692768096924 0.21998894214630127 0.21964969635009765 0.00013016817209975755

comparison

name current previous winner diff
write_http_headers 0.004917895793914795 0.004955291748046875 current 0%
bytebuffer_write_12MB_short_string_literals 0.49164170026779175 0.4993636965751648 current -1%
bytebuffer_write_12MB_short_calculated_strings 0.4864711046218872 0.5043087959289551 current -3%
bytebuffer_write_12MB_medium_string_literals 0.17525429725646974 0.17664359807968139 current 0%
bytebuffer_write_12MB_medium_calculated_strings 0.2371500015258789 0.23336260318756102 previous 1%
bytebuffer_write_12MB_large_calculated_strings 0.2142964005470276 0.21211180686950684 previous 0%
bytebuffer_lots_of_rw 0.5510208010673523 0.5529788851737976 current 0%
bytebuffer_write_http_response_ascii_only_as_string 0.03825398683547974 0.039397799968719484 current -3%
bytebuffer_write_http_response_ascii_only_as_staticstring 0.028921401500701903 0.029420077800750732 current -1%
bytebuffer_write_http_response_some_nonascii_as_string 0.038419902324676514 0.03936450481414795 current -2%
bytebuffer_write_http_response_some_nonascii_as_staticstring 0.028941404819488526 0.029394078254699706 current -1%
no-net_http1_10k_reqs_1_conn 0.14584839344024658 0.14692609310150145 current 0%
http1_10k_reqs_1_conn 0.5886618018150329 0.5912788867950439 previous 0%
http1_10k_reqs_100_conns 0.588367509841919 0.5932942867279053 current 0%
future_whenallsucceed_100k_immediately_succeeded_off_loop 0.12122578620910644 0.12212870121002198 current -1%
future_whenallsucceed_100k_immediately_succeeded_on_loop 0.12310531139373779 0.12381690740585327 current 0%
future_whenallsucceed_100k_deferred_off_loop 0.6194928169250489 0.6185528993606567 previous 0%
future_whenallsucceed_100k_deferred_on_loop 0.19380581378936768 0.19100161790847778 previous 1%
future_whenallcomplete_100k_immediately_succeeded_off_loop 0.10138758420944213 0.1010849118232727 current 0%
future_whenallcomplete_100k_immediately_succeeded_on_loop 0.1023062825202942 0.10155260562896729 previous 0%
future_whenallcomplete_100k_deferred_off_loop 0.6075155973434448 0.6014117002487183 previous 0%
future_whenallcomplete_100k_deferred_on_loop 0.1786622166633606 0.17481532096862792 previous 2%
future_reduce_10k_futures 0.04827449321746826 0.049259293079376223 current -2%
future_reduce_into_10k_futures 0.04833430051803589 0.04943760633468628 current -2%
channel_pipeline_1m_events 0.21964969635009765 0.22328560352325438 current -1%

significant differences found

@weissi

This comment has been minimized.

Copy link
Member Author

commented Sep 6, 2019

@swift-nio-bot test this please

@Lukasa Lukasa added this to the 2.8.0 milestone Sep 9, 2019

@Lukasa
Lukasa approved these changes Sep 9, 2019

@Lukasa Lukasa merged commit cee3db7 into apple:master Sep 9, 2019

4 checks passed

pull request validation (5.0) Build finished.
Details
pull request validation (5.1) Build finished.
Details
pull request validation (api breakage) Build finished.
Details
pull request validation (sanity) Build finished.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.