Azure / azure-c-shared-utility

Azure C SDKs common code
Other
111 stars 203 forks source link

Fail to upload long Blob using mbedtls+compact(Issue #1995) #536

Closed maallahatem closed 3 years ago

maallahatem commented 3 years ago

Hello, The aim of this pull request is to propose a fix for the bug Fail to upload long Blob using mbedtls+compact #1995 Note, that the other part of the solution is available a PR on the azure-iot-sdk-c repository #2004

Regard Hatem

ericwolz commented 3 years ago

/azp run

azure-pipelines[bot] commented 3 years ago
Azure Pipelines successfully started running 1 pipeline(s).
ericwolz commented 3 years ago

There are unit test failures

2021-06-23T23:14:47.2835155Z ==3363== Command: /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe 2021-06-23T23:14:47.2836156Z ==3363== 2021-06-23T23:14:47.2836978Z ==3363== Conditional jump or move depends on uninitialised value(s) 2021-06-23T23:14:47.2838393Z ==3363== at 0x2B9AE1: on_send_complete (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2840035Z ==3363== by 0x2B090A: my_xio_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2842645Z ==3363== by 0x16F9BB: xio_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2844729Z ==3363== by 0x2B9C2C: on_io_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2846778Z ==3363== by 0x2B09E4: my_mbedtls_ssl_write (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2848469Z ==3363== by 0x26464A: mbedtls_ssl_write (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2850098Z ==3363== by 0x2BA9C3: tlsio_mbedtls_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2851776Z ==3363== by 0x2B6AE6: tlsio_mbedtls_send_large_payload_failure (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2853441Z ==3363== by 0x2C192D: RunTests (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2854976Z ==3363== by 0x2BBB84: main (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2856072Z ==3363== Uninitialised value was created by a stack allocation 2021-06-23T23:14:47.2857520Z ==3363== at 0x2B6612: tlsio_mbedtls_send_large_payload_failure (in /__w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2858700Z ==3363== 2021-06-23T23:14:47.2859418Z { 2021-06-23T23:14:47.2860121Z 2021-06-23T23:14:47.2860857Z Memcheck:Cond 2021-06-23T23:14:47.2861569Z fun:on_send_complete 2021-06-23T23:14:47.2862281Z fun:my_xio_send 2021-06-23T23:14:47.2862986Z fun:xio_send 2021-06-23T23:14:47.2863675Z fun:on_io_send 2021-06-23T23:14:47.2864383Z fun:my_mbedtls_ssl_write 2021-06-23T23:14:47.2865113Z fun:mbedtls_ssl_write 2021-06-23T23:14:47.2865852Z fun:tlsio_mbedtls_send 2021-06-23T23:14:47.2866625Z fun:tlsio_mbedtls_send_large_payload_failure 2021-06-23T23:14:47.2867376Z fun:RunTests 2021-06-23T23:14:47.2868068Z fun:main 2021-06-23T23:14:47.2868711Z } 2021-06-23T23:14:47.2869609Z ==3363== Conditional jump or move depends on uninitialised value(s) 2021-06-23T23:14:47.2871034Z ==3363== at 0x2B9AE1: on_send_complete (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2872606Z ==3363== by 0x2B08F6: my_xio_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2874326Z ==3363== by 0x16FB3D: xio_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2875874Z ==3363== by 0x2B9C2C: on_io_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2877431Z ==3363== by 0x2B09E4: my_mbedtls_ssl_write (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2879069Z ==3363== by 0x264725: mbedtls_ssl_write (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2890417Z ==3363== by 0x2BA9C3: tlsio_mbedtls_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2892185Z ==3363== by 0x2B6AE6: tlsio_mbedtls_send_large_payload_failure (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2896272Z ==3363== by 0x2C192D: RunTests (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2898288Z ==3363== by 0x2BBB84: main (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2899530Z ==3363== Uninitialised value was created by a stack allocation 2021-06-23T23:14:47.2901038Z ==3363== at 0x2B6612: tlsio_mbedtls_send_large_payload_failure (in /__w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2902100Z ==3363== 2021-06-23T23:14:47.2902761Z { 2021-06-23T23:14:47.2903646Z 2021-06-23T23:14:47.2904399Z Memcheck:Cond 2021-06-23T23:14:47.2905128Z fun:on_send_complete 2021-06-23T23:14:47.2905851Z fun:my_xio_send 2021-06-23T23:14:47.2906552Z fun:xio_send 2021-06-23T23:14:47.2907243Z fun:on_io_send 2021-06-23T23:14:47.2908125Z fun:my_mbedtls_ssl_write 2021-06-23T23:14:47.2908879Z fun:mbedtls_ssl_write 2021-06-23T23:14:47.2909602Z fun:tlsio_mbedtls_send 2021-06-23T23:14:47.2910397Z fun:tlsio_mbedtls_send_large_payload_failure 2021-06-23T23:14:47.2911163Z fun:RunTests 2021-06-23T23:14:47.2911840Z fun:main 2021-06-23T23:14:47.2912479Z } 2021-06-23T23:14:47.2913240Z ==3363== Conditional jump or move depends on uninitialised value(s) 2021-06-23T23:14:47.2914660Z ==3363== at 0x2B9AE1: on_send_complete (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2916261Z ==3363== by 0x2B090A: my_xio_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2917807Z ==3363== by 0x16FB3D: xio_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2919341Z ==3363== by 0x2B9C2C: on_io_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2920922Z ==3363== by 0x2B09E4: my_mbedtls_ssl_write (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2922507Z ==3363== by 0x264725: mbedtls_ssl_write (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2923922Z ==3363== by 0x2BA9C3: tlsio_mbedtls_send (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2925497Z ==3363== by 0x2B63B5: tlsio_mbedtls_send_large_payload_success (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2927142Z ==3363== by 0x2C192D: RunTests (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2928496Z ==3363== by 0x2BBB84: main (in /__w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2929375Z ==3363== Uninitialised value was created by a stack allocation 2021-06-23T23:14:47.2930575Z ==3363== at 0x2B5EEB: tlsio_mbedtls_send_large_payload_success (in /__w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.2931567Z ==3363== 2021-06-23T23:14:47.2932032Z { 2021-06-23T23:14:47.2932410Z 2021-06-23T23:14:47.2932929Z Memcheck:Cond 2021-06-23T23:14:47.2933424Z fun:on_send_complete 2021-06-23T23:14:47.2933918Z fun:my_xio_send 2021-06-23T23:14:47.2934410Z fun:xio_send 2021-06-23T23:14:47.2934886Z fun:on_io_send 2021-06-23T23:14:47.2935379Z fun:my_mbedtls_ssl_write 2021-06-23T23:14:47.2935888Z fun:mbedtls_ssl_write 2021-06-23T23:14:47.2936410Z fun:tlsio_mbedtls_send 2021-06-23T23:14:47.2936973Z fun:tlsio_mbedtls_send_large_payload_success 2021-06-23T23:14:47.2937508Z fun:RunTests 2021-06-23T23:14:47.2937969Z fun:main 2021-06-23T23:14:47.2938394Z }

2021-06-23T23:14:47.3050143Z ==3363== 2021-06-23T23:14:47.3050705Z ==3363== HEAP SUMMARY: 2021-06-23T23:14:47.3051289Z ==3363== in use at exit: 81,264 bytes in 6 blocks 2021-06-23T23:14:47.3051994Z ==3363== total heap usage: 8,765 allocs, 8,759 frees, 1,409,456 bytes allocated 2021-06-23T23:14:47.3052605Z ==3363== 2021-06-23T23:14:47.3053248Z ==3363== 40,632 (40,608 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 6 2021-06-23T23:14:47.3054286Z ==3363== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 2021-06-23T23:14:47.3055507Z ==3363== by 0x125FD6: my_gballoc_calloc (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3056796Z ==3363== by 0x12F2F6: gballoc_calloc (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3058119Z ==3363== by 0x2BA0AE: tlsio_mbedtls_create (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3059484Z ==3363== by 0x2B6669: tlsio_mbedtls_send_large_payload_failure (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3060797Z ==3363== by 0x2C192D: RunTests (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3062054Z ==3363== by 0x2BBB84: main (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3062777Z ==3363== 2021-06-23T23:14:47.3063205Z { 2021-06-23T23:14:47.3063703Z 2021-06-23T23:14:47.3064109Z Memcheck:Leak 2021-06-23T23:14:47.3064849Z match-leak-kinds: definite 2021-06-23T23:14:47.3065411Z fun:calloc 2021-06-23T23:14:47.3065902Z fun:my_gballoc_calloc 2021-06-23T23:14:47.3066433Z fun:gballoc_calloc 2021-06-23T23:14:47.3066936Z fun:tlsio_mbedtls_create 2021-06-23T23:14:47.3067499Z fun:tlsio_mbedtls_send_large_payload_failure 2021-06-23T23:14:47.3068040Z fun:RunTests 2021-06-23T23:14:47.3068521Z fun:main 2021-06-23T23:14:47.3068956Z } 2021-06-23T23:14:47.3069566Z ==3363== 40,632 (40,608 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 6 2021-06-23T23:14:47.3070850Z ==3363== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 2021-06-23T23:14:47.3078558Z ==3363== by 0x125FD6: my_gballoc_calloc (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3079906Z ==3363== by 0x12F2F6: gballoc_calloc (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3081213Z ==3363== by 0x2BA0AE: tlsio_mbedtls_create (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3082642Z ==3363== by 0x2B5F42: tlsio_mbedtls_send_large_payload_success (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3085601Z ==3363== by 0x2C192D: RunTests (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3087030Z ==3363== by 0x2BBB84: main (in /w/16/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-23T23:14:47.3087822Z ==3363== 2021-06-23T23:14:47.3088297Z { 2021-06-23T23:14:47.3088800Z 2021-06-23T23:14:47.3089330Z Memcheck:Leak 2021-06-23T23:14:47.3090089Z match-leak-kinds: definite 2021-06-23T23:14:47.3090683Z fun:calloc 2021-06-23T23:14:47.3091191Z fun:my_gballoc_calloc 2021-06-23T23:14:47.3091706Z fun:gballoc_calloc 2021-06-23T23:14:47.3092221Z fun:tlsio_mbedtls_create 2021-06-23T23:14:47.3092804Z fun:tlsio_mbedtls_send_large_payload_success 2021-06-23T23:14:47.3093358Z fun:RunTests 2021-06-23T23:14:47.3094003Z fun:main 2021-06-23T23:14:47.3094455Z }

ericwolz commented 3 years ago

/azp run

azure-pipelines[bot] commented 3 years ago
Azure Pipelines successfully started running 1 pipeline(s).
ericwolz commented 3 years ago

Still unit test failures

2021-06-25T18:29:36.9899908Z ==3366== HEAP SUMMARY: 2021-06-25T18:29:36.9900500Z ==3366== in use at exit: 81,264 bytes in 6 blocks 2021-06-25T18:29:36.9901248Z ==3366== total heap usage: 8,765 allocs, 8,759 frees, 1,409,456 bytes allocated 2021-06-25T18:29:36.9901866Z ==3366== 2021-06-25T18:29:36.9902514Z ==3366== 40,632 (40,608 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 6 2021-06-25T18:29:36.9903628Z ==3366== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 2021-06-25T18:29:36.9904895Z ==3366== by 0x125FD6: my_gballoc_calloc (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9906190Z ==3366== by 0x12F2F6: gballoc_calloc (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9907495Z ==3366== by 0x2BA0BC: tlsio_mbedtls_create (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9908886Z ==3366== by 0x2B6677: tlsio_mbedtls_send_large_payload_failure (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9910213Z ==3366== by 0x2C193B: RunTests (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9911454Z ==3366== by 0x2BBB92: main (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9912201Z ==3366== 2021-06-25T18:29:36.9912802Z { 2021-06-25T18:29:36.9913297Z 2021-06-25T18:29:36.9913833Z Memcheck:Leak 2021-06-25T18:29:36.9914621Z match-leak-kinds: definite 2021-06-25T18:29:36.9915204Z fun:calloc 2021-06-25T18:29:36.9915699Z fun:my_gballoc_calloc 2021-06-25T18:29:36.9916207Z fun:gballoc_calloc 2021-06-25T18:29:36.9916732Z fun:tlsio_mbedtls_create 2021-06-25T18:29:36.9917302Z fun:tlsio_mbedtls_send_large_payload_failure 2021-06-25T18:29:36.9917849Z fun:RunTests 2021-06-25T18:29:36.9918318Z fun:main 2021-06-25T18:29:36.9918756Z } 2021-06-25T18:29:36.9919400Z ==3366== 40,632 (40,608 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 6 of 6 2021-06-25T18:29:36.9920518Z ==3366== at 0x4C31B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) 2021-06-25T18:29:36.9921909Z ==3366== by 0x125FD6: my_gballoc_calloc (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9923232Z ==3366== by 0x12F2F6: gballoc_calloc (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9924625Z ==3366== by 0x2BA0BC: tlsio_mbedtls_create (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9926174Z ==3366== by 0x2B5F49: tlsio_mbedtls_send_large_payload_success (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9927569Z ==3366== by 0x2C193B: RunTests (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9928852Z ==3366== by 0x2BBB92: main (in /w/20/s/cmake/shared-util_linux/tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe) 2021-06-25T18:29:36.9929582Z ==3366== 2021-06-25T18:29:36.9930022Z { 2021-06-25T18:29:36.9930518Z 2021-06-25T18:29:36.9931052Z Memcheck:Leak 2021-06-25T18:29:36.9931788Z match-leak-kinds: definite 2021-06-25T18:29:36.9932373Z fun:calloc 2021-06-25T18:29:36.9932896Z fun:my_gballoc_calloc 2021-06-25T18:29:36.9933472Z fun:gballoc_calloc 2021-06-25T18:29:36.9933977Z fun:tlsio_mbedtls_create 2021-06-25T18:29:36.9934547Z fun:tlsio_mbedtls_send_large_payload_success 2021-06-25T18:29:36.9935092Z fun:RunTests 2021-06-25T18:29:36.9935576Z fun:main 2021-06-25T18:29:36.9936010Z } 2021-06-25T18:29:36.9936460Z ==3366== LEAK SUMMARY: 2021-06-25T18:29:36.9937033Z ==3366== definitely lost: 81,216 bytes in 2 blocks 2021-06-25T18:29:36.9937704Z ==3366== indirectly lost: 48 bytes in 4 blocks 2021-06-25T18:29:36.9938659Z ==3366== possibly lost: 0 bytes in 0 blocks 2021-06-25T18:29:36.9939367Z ==3366== still reachable: 0 bytes in 0 blocks 2021-06-25T18:29:36.9940001Z ==3366== suppressed: 0 bytes in 0 blocks 2021-06-25T18:29:36.9940561Z ==3366== 2021-06-25T18:29:36.9941505Z ==3366== For counts of detected and suppressed errors, rerun with: -v 2021-06-25T18:29:36.9942580Z ==3366== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

maallahatem commented 3 years ago

I'm using Valgrind on my side and everything feels fine

valgrind  --leak-check=full ./tlsio_mbedtls_ut_exe
==3398== Memcheck, a memory error detector
==3398== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3398== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==3398== Command: ./tlsio_mbedtls_ut_exe
==3398== 
 === Executing test suite tlsio_mbedtls_ut ===
Executing test tlsio_mbedtls_setoption_renegotiation_value_NULL_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_setoption Line:1024 Invalid value set for tls renegotiation
Test tlsio_mbedtls_setoption_renegotiation_value_NULL_fail result = Succeeded.
Executing test tlsio_mbedtls_setoption_renegotiation_success ...
Test tlsio_mbedtls_setoption_renegotiation_success result = Succeeded.
Executing test tlsio_mbedtls_setoption_certificate_key_success ...
Test tlsio_mbedtls_setoption_certificate_key_success result = Succeeded.
Executing test tlsio_mbedtls_setoption_certificate_success ...
Test tlsio_mbedtls_setoption_certificate_success result = Succeeded.
Executing test tlsio_on_io_recv_context_NULL_success ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:on_io_recv Line:288 Invalid context NULL value passed
Test tlsio_on_io_recv_context_NULL_success result = Succeeded.
Executing test tlsio_on_io_recv_success ...
Test tlsio_on_io_recv_success result = Succeeded.
Executing test tlsio_on_io_recv_timeout_success ...
Test tlsio_on_io_recv_timeout_success result = Succeeded.
Executing test tlsio_on_underlying_io_bytes_received_success ...
Test tlsio_on_underlying_io_bytes_received_success result = Succeeded.
Executing test tlsio_mbedtls_dowork_w_data_success ...
Test tlsio_mbedtls_dowork_w_data_success result = Succeeded.
Executing test tlsio_mbedtls_dowork_success ...
Test tlsio_mbedtls_dowork_success result = Succeeded.
Executing test tlsio_mbedtls_dowork_handle_NULL_fail ...
Test tlsio_mbedtls_dowork_handle_NULL_fail result = Succeeded.
Executing test tlsio_mbedtls_send_large_payload_failure ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:757 Failed to send last fragment with error:0x2, aborting whole send
Test tlsio_mbedtls_send_large_payload_failure result = Succeeded.
Executing test tlsio_mbedtls_send_large_payload_success ...
Test tlsio_mbedtls_send_large_payload_success result = Succeeded.
Executing test tlsio_mbedtls_send_failure ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:751 Unexpected data size returned from  mbedtls_ssl_write -1/3
Test tlsio_mbedtls_send_failure result = Succeeded.
Executing test tlsio_mbedtls_send_success ...
Test tlsio_mbedtls_send_success result = Succeeded.
Executing test tlsio_mbedtls_send_not_open_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:732 Invalid state specified 0
Test tlsio_mbedtls_send_not_open_fail result = Succeeded.
Executing test tlsio_mbedtls_send_handle_NULL_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:724 Invalid parameter specified tls_io: (nil), buffer: 0x2ce946, size: 3l
Test tlsio_mbedtls_send_handle_NULL_fail result = Succeeded.
Executing test tlsio_mbedtls_close_multiple_calls_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_close Line:678 IO should not be closed: 4
Test tlsio_mbedtls_close_multiple_calls_fail result = Succeeded.
Executing test tlsio_mbedtls_close_success ...
Test tlsio_mbedtls_close_success result = Succeeded.
Executing test tlsio_mbedtls_close_handle_NULL_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_close Line:668 Invalid parameter specified tls_io: NULL
Test tlsio_mbedtls_close_handle_NULL_fail result = Succeeded.
Executing test tlsio_entropy_poll_success ...
Test tlsio_entropy_poll_success result = Succeeded.
Executing test tlsio_mbedtls_open_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_open Line:653 Underlying IO open failed
Test tlsio_mbedtls_open_fail result = Succeeded.
Executing test tlsio_mbedtls_open_multiple_calls_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_open Line:631 IO should not be open: 1
Test tlsio_mbedtls_open_multiple_calls_fail result = Succeeded.
Executing test tlsio_mbedtls_open_succeed ...
Test tlsio_mbedtls_open_succeed result = Succeeded.
Executing test tlsio_mbedtls_open_handle_NULL_fail ...
Error: Time:Mon Jun 28 12:34:01 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_open Line:622 Invalid parameter specified tls_io: NULL
Test tlsio_mbedtls_open_handle_NULL_fail result = Succeeded.
Executing test tlsio_mbedtls_destroy_handle_NULL_fail ...
Test tlsio_mbedtls_destroy_handle_NULL_fail result = Succeeded.
Executing test tlsio_mbedtls_destroy_succeed ...
Test tlsio_mbedtls_destroy_succeed result = Succeeded.
Executing test tlsio_mbedtls_create_fail ...
Error: Time:Mon Jun 28 12:34:02 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_create Line:570 Failure allocating TLS object
Error: Time:Mon Jun 28 12:34:02 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_create Line:550 Failure allocating hostname.
Test tlsio_mbedtls_create_fail result = Succeeded.
Executing test tlsio_mbedtls_create_succeed ...
Test tlsio_mbedtls_create_succeed result = Succeeded.
Executing test tlsio_mbedtls_create_config_NULL_fail ...
Error: Time:Mon Jun 28 12:34:02 2021 File:/home/hatem/work/azure-c-shared-utility/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_create Line:511 NULL tls_io_config
Test tlsio_mbedtls_create_config_NULL_fail result = Succeeded.
30 tests ran, 0 failed, 30 succeeded.
==3398== 
==3398== HEAP SUMMARY:
==3398==     in use at exit: 0 bytes in 0 blocks
==3398==   total heap usage: 8,708 allocs, 8,708 frees, 1,404,155 bytes allocated
==3398== 
==3398== All heap blocks were freed -- no leaks are possible
==3398== 
==3398== For lists of detected and suppressed errors, rerun with: -s
==3398== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
ericwolz commented 3 years ago

We can't upgrade from valgrind 3.12 because there is no newer release on Ubuntu-18.04 I can look at adding valgrind suppressing rules.

There are still other failures as below.

2021-06-25T18:29:35.4783949Z [0mExecuting test tlsio_mbedtls_dowork_handle_NULL_fail ... 2021-06-25T18:29:35.4785214Z [32mTest tlsio_mbedtls_dowork_handle_NULL_fail result = Succeeded. 2021-06-25T18:29:35.4786499Z [0mExecuting test tlsio_mbedtls_send_large_payload_failure ... 2021-06-25T18:29:35.4787752Z Error: Time:Fri Jun 25 18:29:34 2021 File:/__w/20/s/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:758 Failed to send last fragment with error:0x2, aborting whole send 2021-06-25T18:29:35.4790290Z Assert failed in line 957 Expected: [mbedtls_ssl_get_max_frag_len((nil))][mbedtls_ssl_write((nil),0x52,2)][xio_send((nil),(nil),0,(nil),(nil))][on_send_complete((nil),IO_SEND_ERROR)], Actual: [on_send_complete((nil),IO_SEND_OK)][mbedtls_ssl_get_max_frag_len(0x557185ae5628)][mbedtls_ssl_write(0x557185ae5628,0x52,2)][xio_send(0x557185ae6940,0x52,2,0x557183de4a89,0x557185adbfe0)][on_send_complete((nil),IO_SEND_ERROR)] 2021-06-25T18:29:35.4793052Z [31mTest tlsio_mbedtls_send_large_payload_failure result = !!! FAILED !!! 2021-06-25T18:29:35.4794475Z [0mExecuting test tlsio_mbedtls_send_large_payload_success ... 2021-06-25T18:29:35.4796841Z Assert failed in line 912 Expected: [mbedtls_ssl_get_max_frag_len((nil))][mbedtls_ssl_write((nil),0x52,2)][xio_send((nil),(nil),0,(nil),(nil))][mbedtls_ssl_get_max_frag_len((nil))][mbedtls_ssl_write((nil),0x53,1)][xio_send((nil),(nil),0,(nil),(nil))][on_send_complete((nil),IO_SEND_OK)], Actual: [on_send_complete((nil),IO_SEND_OK)][mbedtls_ssl_get_max_frag_len(0x557185af2fb8)][mbedtls_ssl_write(0x557185af2fb8,0x52,2)][xio_send(0x557185ae5f20,0x52,2,0x557183de4a89,0x557185ae9970)][on_send_complete((nil),IO_SEND_OK)][mbedtls_ssl_get_max_frag_len(0x557185af2fb8)][mbedtls_ssl_write(0x557185af2fb8,0x53,1)][xio_send(0x557185ae5f20,0x53,1,0x557183de4a89,0x557185ae9970)][on_send_complete((nil),IO_SEND_OK)] 2021-06-25T18:29:35.4800079Z [31mTest tlsio_mbedtls_send_large_payload_success result = !!! FAILED !!! 2021-06-25T18:29:35.4801713Z [0mExecuting test tlsio_mbedtls_send_failure ...

ericwolz commented 3 years ago

Humm, ran it under valgrind v3.15 and I still see the memory leak errors. Are you sure you are on the branch SE/fix_blob_upload_fail_mbedtls_1995?

$ valgrind tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe ==21265== Memcheck, a memory error detector ==21265== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==21265== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info ==21265== Command: tests/tlsio_mbedtls_ut/tlsio_mbedtls_ut_exe ==21265== === Executing test suite tlsio_mbedtls_ut === Executing test tlsio_mbedtls_setoption_renegotiation_value_NULL_fail ... Error: Time:Tue Jun 29 18:20:11 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_setoption Line:1024 Invalid value set for tls renegotiation Test tlsio_mbedtls_setoption_renegotiation_value_NULL_fail result = Succeeded. Executing test tlsio_mbedtls_setoption_renegotiation_success ... Test tlsio_mbedtls_setoption_renegotiation_success result = Succeeded. Executing test tlsio_mbedtls_setoption_certificate_key_success ... Test tlsio_mbedtls_setoption_certificate_key_success result = Succeeded. Executing test tlsio_mbedtls_setoption_certificate_success ... Test tlsio_mbedtls_setoption_certificate_success result = Succeeded. Executing test tlsio_on_io_recv_context_NULL_success ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:on_io_recv Line:288 Invalid context NULL value passed Test tlsio_on_io_recv_context_NULL_success result = Succeeded. Executing test tlsio_on_io_recv_success ... Test tlsio_on_io_recv_success result = Succeeded. Executing test tlsio_on_io_recv_timeout_success ... Test tlsio_on_io_recv_timeout_success result = Succeeded. Executing test tlsio_on_underlying_io_bytes_received_success ... Test tlsio_on_underlying_io_bytes_received_success result = Succeeded. Executing test tlsio_mbedtls_dowork_w_data_success ... Test tlsio_mbedtls_dowork_w_data_success result = Succeeded. Executing test tlsio_mbedtls_dowork_success ... Test tlsio_mbedtls_dowork_success result = Succeeded. Executing test tlsio_mbedtls_dowork_handle_NULL_fail ... Test tlsio_mbedtls_dowork_handle_NULL_fail result = Succeeded. Executing test tlsio_mbedtls_send_large_payload_failure ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:757 Failed to send last fragment with error:0x2, aborting whole send Assert failed in line 957 Expected: [mbedtls_ssl_get_max_frag_len((nil))][mbedtls_ssl_write((nil),0x52,2)][xio_send((nil),(nil),0,(nil),(nil))][on_send_complete((nil),IO_SEND_ERROR)], Actual: [on_send_complete((nil),IO_SEND_OK)][mbedtls_ssl_get_max_frag_len(0x4b1f278)][mbedtls_ssl_write(0x4b1f278,0x52,2)][xio_send(0x4b20180,0x52,2,0x2c35d8,0x4b15c30)][on_send_complete((nil),IO_SEND_ERROR)] Test tlsio_mbedtls_send_large_payload_failure result = !!! FAILED !!! Executing test tlsio_mbedtls_send_large_payload_success ... Assert failed in line 912 Expected: [mbedtls_ssl_get_max_frag_len((nil))][mbedtls_ssl_write((nil),0x52,2)][xio_send((nil),(nil),0,(nil),(nil))][mbedtls_ssl_get_max_frag_len((nil))][mbedtls_ssl_write((nil),0x53,1)][xio_send((nil),(nil),0,(nil),(nil))][on_send_complete((nil),IO_SEND_OK)], Actual: [on_send_complete((nil),IO_SEND_OK)][mbedtls_ssl_get_max_frag_len(0x4b35968)][mbedtls_ssl_write(0x4b35968,0x52,2)][xio_send(0x4b36870,0x52,2,0x2c35d8,0x4b2c320)][on_send_complete((nil),IO_SEND_OK)][mbedtls_ssl_get_max_frag_len(0x4b35968)][mbedtls_ssl_write(0x4b35968,0x53,1)][xio_send(0x4b36870,0x53,1,0x2c35d8,0x4b2c320)][on_send_complete((nil),IO_SEND_OK)] Test tlsio_mbedtls_send_large_payload_success result = !!! FAILED !!! Executing test tlsio_mbedtls_send_failure ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:751 Unexpected data size returned from mbedtls_ssl_write -1/3 Test tlsio_mbedtls_send_failure result = Succeeded. Executing test tlsio_mbedtls_send_success ... Test tlsio_mbedtls_send_success result = Succeeded. Executing test tlsio_mbedtls_send_not_open_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:732 Invalid state specified 0 Test tlsio_mbedtls_send_not_open_fail result = Succeeded. Executing test tlsio_mbedtls_send_handle_NULL_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_send Line:724 Invalid parameter specified tls_io: (nil), buffer: 0x2ce946, size: 3l Test tlsio_mbedtls_send_handle_NULL_fail result = Succeeded. Executing test tlsio_mbedtls_close_multiple_calls_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_close Line:678 IO should not be closed: 4 Test tlsio_mbedtls_close_multiple_calls_fail result = Succeeded. Executing test tlsio_mbedtls_close_success ... Test tlsio_mbedtls_close_success result = Succeeded. Executing test tlsio_mbedtls_close_handle_NULL_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_close Line:668 Invalid parameter specified tls_io: NULL Test tlsio_mbedtls_close_handle_NULL_fail result = Succeeded. Executing test tlsio_entropy_poll_success ... Test tlsio_entropy_poll_success result = Succeeded. Executing test tlsio_mbedtls_open_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_open Line:653 Underlying IO open failed Test tlsio_mbedtls_open_fail result = Succeeded. Executing test tlsio_mbedtls_open_multiple_calls_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_open Line:631 IO should not be open: 1 Test tlsio_mbedtls_open_multiple_calls_fail result = Succeeded. Executing test tlsio_mbedtls_open_succeed ... Test tlsio_mbedtls_open_succeed result = Succeeded. Executing test tlsio_mbedtls_open_handle_NULL_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_open Line:622 Invalid parameter specified tls_io: NULL Test tlsio_mbedtls_open_handle_NULL_fail result = Succeeded. Executing test tlsio_mbedtls_destroy_handle_NULL_fail ... Test tlsio_mbedtls_destroy_handle_NULL_fail result = Succeeded. Executing test tlsio_mbedtls_destroy_succeed ... Test tlsio_mbedtls_destroy_succeed result = Succeeded. Executing test tlsio_mbedtls_create_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_create Line:570 Failure allocating TLS object Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_create Line:550 Failure allocating hostname. Test tlsio_mbedtls_create_fail result = Succeeded. Executing test tlsio_mbedtls_create_succeed ... Test tlsio_mbedtls_create_succeed result = Succeeded. Executing test tlsio_mbedtls_create_config_NULL_fail ... Error: Time:Tue Jun 29 18:20:12 2021 File:/mnt/c/temp/azure-c-shared-utility-EcoStruxure/adapters/tlsio_mbedtls.c Func:tlsio_mbedtls_create Line:511 NULL tls_io_config Test tlsio_mbedtls_create_config_NULL_fail result = Succeeded. 30 tests ran, 2 failed, 28 succeeded. ==21265== ==21265== HEAP SUMMARY: ==21265== in use at exit: 81,296 bytes in 6 blocks ==21265== total heap usage: 8,759 allocs, 8,753 frees, 1,405,465 bytes allocated ==21265== ==21265== LEAK SUMMARY: ==21265== definitely lost: 81,248 bytes in 2 blocks ==21265== indirectly lost: 48 bytes in 4 blocks ==21265== possibly lost: 0 bytes in 0 blocks ==21265== still reachable: 0 bytes in 0 blocks ==21265== suppressed: 0 bytes in 0 blocks ==21265== Rerun with --leak-check=full to see details of leaked memory ==21265== ==21265== For lists of detected and suppressed errors, rerun with: -s ==21265== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

maallahatem commented 3 years ago

I'm sorry, it seems that I'm using the wrong branch, Now everything is ok, Could you check in your side, please

Regards

ericwolz commented 3 years ago

/azp run

azure-pipelines[bot] commented 3 years ago
Azure Pipelines successfully started running 1 pipeline(s).
ericwolz commented 3 years ago

@maallahatem thanks. We will validate this before merging the PR.