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

FIO_ASSERT: return errno(22) #22

Closed
kassane opened this issue Sep 28, 2023 · 5 comments
Closed

FIO_ASSERT: return errno(22) #22

kassane opened this issue Sep 28, 2023 · 5 comments

Comments

@kassane
Copy link

kassane commented Sep 28, 2023

Ref.: #15 #17

Output log

mustache
DEBUG:    21483 scheduling AT_EXIT callbacks.
DEBUG:    testing leaks for fio___http_connection
DEBUG:    testing leaks for fio___http_protocol
DEBUG:    HTTP MIME hash storage count/capa: 91 / 128
DEBUG:    testing leaks for fio___http_mime_map_s
DEBUG:    testing leaks for fio_http
DEBUG:    testing leaks for fio___http_cmap_destroy
DEBUG:    testing leaks for fio___http_cmap_s
DEBUG:    testing leaks for fio___http_hmap_destroy
DEBUG:    testing leaks for fio___http_hmap_s
DEBUG:    testing leaks for fio___http_sary_destroy
DEBUG:    testing leaks for fio___http_sary_s
DEBUG:    testing leaks for fio___http_str_cache_destroy
DEBUG:    testing leaks for fio___http_str_cache_s
DEBUG:    testing leaks for http___keystr_allocator
DEBUG:    testing leaks for fio___pubsub_message_map_destroy
DEBUG:    testing leaks for fio___pubsub_message_map_s
DEBUG:    testing leaks for fio___pubsub_engines_destroy
DEBUG:    testing leaks for fio___pubsub_engines_s
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_destroy
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_s
DEBUG:    testing leaks for fio___postoffice_msmap_destroy
DEBUG:    testing leaks for fio___postoffice_msmap_s
DEBUG:    testing leaks for fio___channel_map_destroy
DEBUG:    testing leaks for fio___channel_map_s
DEBUG:    testing leaks for fio___pubsub_message_parser_s
DEBUG:    testing leaks for fio___pubsub_message
DEBUG:    testing leaks for fio_subscription
DEBUG:    testing leaks for fio_channel
DEBUG:    testing leaks for fio_tls
DEBUG:    testing leaks for fio___tls_cert_map_s
DEBUG:    testing leaks for fio___tls_trust_map_s
DEBUG:    testing leaks for fio___tls_alpn_map_s
DEBUG:    testing leaks for fio_srv_listen
DEBUG:    testing leaks for fio
DEBUG:    testing leaks for fio___srv_env_destroy
DEBUG:    testing leaks for fio___srv_env_s
DEBUG:    testing leaks for fio___timer_event_s
DEBUG:    testing leaks for fio_queue_task_rings
DEBUG:    testing leaks for fio_queue
DEBUG:    testing leaks for fio_stream_packet_s
DEBUG:    starting facil.io memory allocator cleanup for fio_malloc.
DEBUG:    (fio_malloc) total allocations: 0
DEBUG:    finished facil.io memory allocator cleanup for fio_malloc.
DEBUG:    testing leaks for fio_malloc
DEBUG:    testing leaks for fio___malloc_chunk
DEBUG:    testing leaks for fiobj___stack_destroy
DEBUG:    testing leaks for fiobj___stack_s
DEBUG:    testing leaks for fiobj___active_stack_destroy
DEBUG:    testing leaks for fiobj___active_stack_s
DEBUG:    testing leaks for fiobj___bigfloat
DEBUG:    testing leaks for fiobj___bignum
DEBUG:    testing leaks for fiobj_hash
DEBUG:    testing leaks for fiobj_hash_destroy
DEBUG:    testing leaks for fiobj_hash_s
DEBUG:    testing leaks for fiobj_array
DEBUG:    testing leaks for fiobj_array_destroy
DEBUG:    testing leaks for fiobj_array_s
DEBUG:    testing leaks for fiobj_str
DEBUG:    testing leaks for fiobj_str_destroy
DEBUG:    testing leaks for fiobj_str_s
DEBUG:    testing leaks for fiobj_object
DEBUG:    testing leaks for fio_mustache_s
DEBUG:    testing leaks for fio_string_default_key_allocations
DEBUG:    testing leaks for fio_string_default_allocations
DEBUG:    testing leaks for fio_keystr_s
DEBUG:    testing leaks for fio_bstr_s
DEBUG:    starting facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7fedb0800000 in cache
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7fedb0800000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7fedb0800000
DEBUG:    (fiobj_mem_malloc) total allocations: 2859
DEBUG:    finished facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    testing leaks for fiobj_mem_malloc
DEBUG:    testing leaks for fiobj_mem___malloc_chunk
DEBUG:    testing leaks for fio___cli_amap_s
DEBUG:    testing leaks for fio_cli_help_writer
DEBUG:    testing leaks for fio_cli_ary
DEBUG:    testing leaks for fio_cli_str
FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(0): Success
stl
DEBUG:    21510 scheduling AT_EXIT callbacks.
DEBUG:    testing leaks for fio_imap_tester_s
DEBUG:    testing leaks for fio_small_str_destroy
DEBUG:    testing leaks for fio_small_str_s
DEBUG:    testing leaks for fio_big_str_destroy
DEBUG:    testing leaks for fio_big_str_s
DEBUG:    testing leaks for omap___test_size_lru_destroy
DEBUG:    testing leaks for omap___test_size_lru_s
DEBUG:    starting facil.io memory allocator cleanup for omap___test_size_lru_mem_malloc.
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91abe00000 in cache
DEBUG:    MEMORY chunk 0x7f91abc00000 no longer used as big-block
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91abc00000 in cache
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91abc00000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91abc00000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91abe00000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91abe00000
DEBUG:    (omap___test_size_lru_mem_malloc) total allocations: 13
DEBUG:    finished facil.io memory allocator cleanup for omap___test_size_lru_mem_malloc.
DEBUG:    testing leaks for omap___test_size_lru_mem_malloc
DEBUG:    testing leaks for omap___test_size_lru_mem___malloc_chunk
DEBUG:    testing leaks for omap___test_size_t_destroy
DEBUG:    testing leaks for omap___test_size_t_s
DEBUG:    starting facil.io memory allocator cleanup for omap___test_size_t_mem_malloc.
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91ac000000 in cache
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91ac000000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91ac000000
DEBUG:    (omap___test_size_t_mem_malloc) total allocations: 13
DEBUG:    finished facil.io memory allocator cleanup for omap___test_size_t_mem_malloc.
DEBUG:    testing leaks for omap___test_size_t_mem_malloc
DEBUG:    testing leaks for omap___test_size_t_mem___malloc_chunk
DEBUG:    testing leaks for umap___test_size_destroy
DEBUG:    testing leaks for umap___test_size_s
DEBUG:    starting facil.io memory allocator cleanup for umap___test_size_mem_malloc.
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91ac200000 in cache
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91ac200000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91ac200000
DEBUG:    (umap___test_size_mem_malloc) total allocations: 13
DEBUG:    finished facil.io memory allocator cleanup for umap___test_size_mem_malloc.
DEBUG:    testing leaks for umap___test_size_mem_malloc
DEBUG:    testing leaks for umap___test_size_mem___malloc_chunk
DEBUG:    testing leaks for uset___test_size_t_destroy
DEBUG:    testing leaks for uset___test_size_t_s
DEBUG:    starting facil.io memory allocator cleanup for uset___test_size_t_mem_malloc.
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91ae200000 in cache
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91ae200000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91ae200000
DEBUG:    (uset___test_size_t_mem_malloc) total allocations: 13
DEBUG:    finished facil.io memory allocator cleanup for uset___test_size_t_mem_malloc.
DEBUG:    testing leaks for uset___test_size_t_mem_malloc
DEBUG:    testing leaks for uset___test_size_t_mem___malloc_chunk
DEBUG:    testing leaks for ary3____test_destroy
DEBUG:    testing leaks for ary3____test_s
DEBUG:    testing leaks for ary2____test_destroy
DEBUG:    testing leaks for ary2____test_s
DEBUG:    testing leaks for ary____test
DEBUG:    testing leaks for ary____test_destroy
DEBUG:    testing leaks for ary____test_s
DEBUG:    fio_mem_test_unsafe___mem_state_cleanup called more than once (NULL state).
DEBUG:    testing leaks for fio_mem_test_unsafe_malloc
DEBUG:    testing leaks for fio_mem_test_unsafe___malloc_chunk
DEBUG:    fio_mem_test_safe___mem_state_cleanup called more than once (NULL state).
DEBUG:    testing leaks for fio_mem_test_safe_malloc
DEBUG:    testing leaks for fio_mem_test_safe___malloc_chunk
DEBUG:    testing leaks for fio___http_connection
DEBUG:    testing leaks for fio___http_protocol
DEBUG:    HTTP MIME hash storage count/capa: 91 / 128
DEBUG:    testing leaks for fio___http_mime_map_s
DEBUG:    testing leaks for fio_http
DEBUG:    testing leaks for fio___http_cmap_destroy
DEBUG:    testing leaks for fio___http_cmap_s
DEBUG:    testing leaks for fio___http_hmap_destroy
DEBUG:    testing leaks for fio___http_hmap_s
DEBUG:    testing leaks for fio___http_sary_destroy
DEBUG:    testing leaks for fio___http_sary_s
DEBUG:    testing leaks for fio___http_str_cache_destroy
DEBUG:    testing leaks for fio___http_str_cache_s
DEBUG:    testing leaks for http___keystr_allocator
DEBUG:    testing leaks for fio___pubsub_message_map_destroy
DEBUG:    testing leaks for fio___pubsub_message_map_s
DEBUG:    testing leaks for fio___pubsub_engines_destroy
DEBUG:    testing leaks for fio___pubsub_engines_s
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_destroy
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_s
DEBUG:    testing leaks for fio___postoffice_msmap_destroy
DEBUG:    testing leaks for fio___postoffice_msmap_s
DEBUG:    testing leaks for fio___channel_map_destroy
DEBUG:    testing leaks for fio___channel_map_s
DEBUG:    testing leaks for fio___pubsub_message_parser_s
DEBUG:    testing leaks for fio___pubsub_message
DEBUG:    testing leaks for fio_subscription
DEBUG:    testing leaks for fio_channel
DEBUG:    testing leaks for fio_tls
DEBUG:    testing leaks for fio___tls_cert_map_s
DEBUG:    testing leaks for fio___tls_trust_map_s
DEBUG:    testing leaks for fio___tls_alpn_map_s
DEBUG:    testing leaks for fio_srv_listen
DEBUG:    testing leaks for fio
DEBUG:    testing leaks for fio___srv_env_destroy
DEBUG:    testing leaks for fio___srv_env_s
DEBUG:    testing leaks for fio___timer_event_s
DEBUG:    testing leaks for fio_queue_task_rings
DEBUG:    testing leaks for fio_queue
DEBUG:    testing leaks for fio_stream_packet_s
DEBUG:    starting facil.io memory allocator cleanup for fio_malloc.
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91ac800000 in cache
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91aa800000 in cache
DEBUG:    MEMORY chunk 0x7f91ab000000 no longer used as big-block
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91ab000000 in cache
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91ab000000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91ab000000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91aa800000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91aa800000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91ac800000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91ac800000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91a2800000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91a2800000
DEBUG:    (fio_malloc) total allocations: 69042
DEBUG:    finished facil.io memory allocator cleanup for fio_malloc.
DEBUG:    testing leaks for fio_malloc
DEBUG:    testing leaks for fio___malloc_chunk
DEBUG:    testing leaks for fiobj___stack_destroy
DEBUG:    testing leaks for fiobj___stack_s
DEBUG:    testing leaks for fiobj___active_stack_destroy
DEBUG:    testing leaks for fiobj___active_stack_s
DEBUG:    testing leaks for fiobj___bigfloat
DEBUG:    testing leaks for fiobj___bignum
DEBUG:    testing leaks for fiobj_hash
DEBUG:    testing leaks for fiobj_hash_destroy
DEBUG:    testing leaks for fiobj_hash_s
DEBUG:    testing leaks for fiobj_array
DEBUG:    testing leaks for fiobj_array_destroy
DEBUG:    testing leaks for fiobj_array_s
DEBUG:    testing leaks for fiobj_str
DEBUG:    testing leaks for fiobj_str_destroy
DEBUG:    testing leaks for fiobj_str_s
DEBUG:    testing leaks for fiobj_object
DEBUG:    testing leaks for fio_mustache_s
DEBUG:    testing leaks for fio_string_default_key_allocations
DEBUG:    testing leaks for fio_string_default_allocations
DEBUG:    testing leaks for fio_keystr_s
DEBUG:    testing leaks for fio_bstr_s
DEBUG:    starting facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91ac400000 in cache
DEBUG:    MEMORY chunk 0x7f91aa400000 no longer used as big-block
DEBUG:    MEMORY CACHE-DEALLOC placed 0x7f91aa400000 in cache
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91aa400000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91aa400000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f91ac400000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f91ac400000
DEBUG:    (fiobj_mem_malloc) total allocations: 12420
DEBUG:    finished facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    testing leaks for fiobj_mem_malloc
DEBUG:    testing leaks for fiobj_mem___malloc_chunk
DEBUG:    testing leaks for fio___cli_amap_s
DEBUG:    testing leaks for fio_cli_help_writer
DEBUG:    testing leaks for fio_cli_ary
DEBUG:    testing leaks for fio_cli_str
FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(22): Invalid argument
base64
DEBUG:    21761 scheduling AT_EXIT callbacks.
DEBUG:    testing leaks for fio_str_destroy
DEBUG:    testing leaks for fio_str_s
DEBUG:    testing leaks for fio_string_default_key_allocations
DEBUG:    testing leaks for fio_string_default_allocations
DEBUG:    testing leaks for fio_keystr_s
DEBUG:    testing leaks for fio_bstr_s
DEBUG:    starting facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    (fiobj_mem_malloc) total allocations: 0
DEBUG:    finished facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    testing leaks for fiobj_mem_malloc
DEBUG:    testing leaks for fiobj_mem___malloc_chunk
DEBUG:    testing leaks for fio___cli_amap_s
DEBUG:    testing leaks for fio_cli_help_writer
DEBUG:    testing leaks for fio_cli_ary
DEBUG:    testing leaks for fio_cli_str
FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(0): Success
mempool
DEBUG:    MEMORY CACHE-ALLOC allocated 0x7f678cc00000
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678cc00000
DEBUG:    * size_units: 2044, ppu: 2, total pointers: 4088 

* Micro-seconds performing malloc: 6119
* Micro-seconds performing calloc: 16383
* Micro-seconds performing realloc: 23279
* Micro-seconds performing free (realloc): 6699
* Micro-seconds performing free (re-cycle): 4230
* Micro-seconds performing a zero-life span (malloc-free): 6623
* Micro-seconds performing a facil.io use-case round (medium-short life): 141477
* Failed allocations: 0
Total CPU Time (micros): 1638500
DEBUG:    21821 scheduling AT_EXIT callbacks.
DEBUG:    testing leaks for fio___cli_amap_s
DEBUG:    testing leaks for fio_cli_help_writer
DEBUG:    testing leaks for fio_cli_ary
DEBUG:    testing leaks for fio_cli_str
DEBUG:    starting facil.io memory allocator cleanup for fio_malloc.
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f6790c00000
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678f400000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678ec00000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678ec00000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678dc00000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678dc00000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678d800000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678d800000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678e400000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678e400000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678d400000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678d400000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678d000000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678d000000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678c400000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678c400000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678a000000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678a000000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678f000000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678f000000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f6789c00000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f6789c00000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678c000000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678c000000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f6788c00000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f6788c00000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678b000000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678b000000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f6788800000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f6788800000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678b800000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678b800000
DEBUG:    MEMORY CACHE-ALLOC retrieved 0x7f678b400000 from cache
DEBUG:    MEMORY CACHE-DEALLOC de-allocated 0x7f678b400000
DEBUG:    (fio_malloc) total allocations: 654083
DEBUG:    finished facil.io memory allocator cleanup for fio_malloc.
DEBUG:    testing leaks for fio_malloc
DEBUG:    testing leaks for fio___malloc_chunk
FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(0): Success
noop
INFO:     Doing Nothing
DEBUG:    21870 scheduling AT_EXIT callbacks.
DEBUG:    testing leaks for fio___http_connection
DEBUG:    testing leaks for fio___http_protocol
DEBUG:    HTTP MIME hash storage count/capa: 91 / 128
DEBUG:    testing leaks for fio___http_mime_map_s
DEBUG:    testing leaks for fio_http
DEBUG:    testing leaks for fio___http_cmap_destroy
DEBUG:    testing leaks for fio___http_cmap_s
DEBUG:    testing leaks for fio___http_hmap_destroy
DEBUG:    testing leaks for fio___http_hmap_s
DEBUG:    testing leaks for fio___http_sary_destroy
DEBUG:    testing leaks for fio___http_sary_s
DEBUG:    testing leaks for fio___http_str_cache_destroy
DEBUG:    testing leaks for fio___http_str_cache_s
DEBUG:    testing leaks for http___keystr_allocator
DEBUG:    testing leaks for fio___pubsub_message_map_destroy
DEBUG:    testing leaks for fio___pubsub_message_map_s
DEBUG:    testing leaks for fio___pubsub_engines_destroy
DEBUG:    testing leaks for fio___pubsub_engines_s
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_destroy
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_s
DEBUG:    testing leaks for fio___postoffice_msmap_destroy
DEBUG:    testing leaks for fio___postoffice_msmap_s
DEBUG:    testing leaks for fio___channel_map_destroy
DEBUG:    testing leaks for fio___channel_map_s
DEBUG:    testing leaks for fio___pubsub_message_parser_s
DEBUG:    testing leaks for fio___pubsub_message
DEBUG:    testing leaks for fio_subscription
DEBUG:    testing leaks for fio_channel
DEBUG:    testing leaks for fio_tls
DEBUG:    testing leaks for fio___tls_cert_map_s
DEBUG:    testing leaks for fio___tls_trust_map_s
DEBUG:    testing leaks for fio___tls_alpn_map_s
DEBUG:    testing leaks for fio_srv_listen
DEBUG:    testing leaks for fio
DEBUG:    testing leaks for fio___srv_env_destroy
DEBUG:    testing leaks for fio___srv_env_s
DEBUG:    testing leaks for fio___timer_event_s
DEBUG:    testing leaks for fio_queue_task_rings
DEBUG:    testing leaks for fio_queue
DEBUG:    testing leaks for fio_stream_packet_s
DEBUG:    starting facil.io memory allocator cleanup for fio_malloc.
DEBUG:    (fio_malloc) total allocations: 0
DEBUG:    finished facil.io memory allocator cleanup for fio_malloc.
DEBUG:    testing leaks for fio_malloc
DEBUG:    testing leaks for fio___malloc_chunk
DEBUG:    testing leaks for fiobj___stack_destroy
DEBUG:    testing leaks for fiobj___stack_s
DEBUG:    testing leaks for fiobj___active_stack_destroy
DEBUG:    testing leaks for fiobj___active_stack_s
DEBUG:    testing leaks for fiobj___bigfloat
DEBUG:    testing leaks for fiobj___bignum
DEBUG:    testing leaks for fiobj_hash
DEBUG:    testing leaks for fiobj_hash_destroy
DEBUG:    testing leaks for fiobj_hash_s
DEBUG:    testing leaks for fiobj_array
DEBUG:    testing leaks for fiobj_array_destroy
DEBUG:    testing leaks for fiobj_array_s
DEBUG:    testing leaks for fiobj_str
DEBUG:    testing leaks for fiobj_str_destroy
DEBUG:    testing leaks for fiobj_str_s
DEBUG:    testing leaks for fiobj_object
DEBUG:    testing leaks for fio_mustache_s
DEBUG:    testing leaks for fio_string_default_key_allocations
DEBUG:    testing leaks for fio_string_default_allocations
DEBUG:    testing leaks for fio_keystr_s
DEBUG:    testing leaks for fio_bstr_s
DEBUG:    starting facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    (fiobj_mem_malloc) total allocations: 0
DEBUG:    finished facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    testing leaks for fiobj_mem_malloc
DEBUG:    testing leaks for fiobj_mem___malloc_chunk
DEBUG:    testing leaks for fio___cli_amap_s
DEBUG:    testing leaks for fio_cli_help_writer
DEBUG:    testing leaks for fio_cli_ary
DEBUG:    testing leaks for fio_cli_str
FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(0): Success
client
DEBUG:    21994 scheduling AT_EXIT callbacks.
DEBUG:    testing leaks for fio___http_connection
DEBUG:    testing leaks for fio___http_protocol
DEBUG:    HTTP MIME hash storage count/capa: 91 / 128
DEBUG:    testing leaks for fio___http_mime_map_s
DEBUG:    testing leaks for fio_http
DEBUG:    testing leaks for fio___http_cmap_destroy
DEBUG:    testing leaks for fio___http_cmap_s
DEBUG:    testing leaks for fio___http_hmap_destroy
DEBUG:    testing leaks for fio___http_hmap_s
DEBUG:    testing leaks for fio___http_sary_destroy
DEBUG:    testing leaks for fio___http_sary_s
DEBUG:    testing leaks for fio___http_str_cache_destroy
DEBUG:    testing leaks for fio___http_str_cache_s
DEBUG:    testing leaks for http___keystr_allocator
DEBUG:    testing leaks for fio___pubsub_message_map_destroy
DEBUG:    testing leaks for fio___pubsub_message_map_s
DEBUG:    testing leaks for fio___pubsub_engines_destroy
DEBUG:    testing leaks for fio___pubsub_engines_s
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_destroy
DEBUG:    testing leaks for fio___pubsub_broadcast_connected_s
DEBUG:    testing leaks for fio___postoffice_msmap_destroy
DEBUG:    testing leaks for fio___postoffice_msmap_s
DEBUG:    testing leaks for fio___channel_map_destroy
DEBUG:    testing leaks for fio___channel_map_s
DEBUG:    testing leaks for fio___pubsub_message_parser_s
DEBUG:    testing leaks for fio___pubsub_message
DEBUG:    testing leaks for fio_subscription
DEBUG:    testing leaks for fio_channel
DEBUG:    testing leaks for fio_tls
DEBUG:    testing leaks for fio___tls_cert_map_s
DEBUG:    testing leaks for fio___tls_trust_map_s
DEBUG:    testing leaks for fio___tls_alpn_map_s
DEBUG:    testing leaks for fio_srv_listen
DEBUG:    testing leaks for fio
DEBUG:    testing leaks for fio___srv_env_destroy
DEBUG:    testing leaks for fio___srv_env_s
DEBUG:    testing leaks for fio___timer_event_s
DEBUG:    testing leaks for fio_queue_task_rings
DEBUG:    testing leaks for fio_queue
DEBUG:    testing leaks for fio_stream_packet_s
DEBUG:    testing leaks for fio_string_default_key_allocations
DEBUG:    testing leaks for fio_string_default_allocations
DEBUG:    testing leaks for fio_keystr_s
DEBUG:    testing leaks for fio_bstr_s
DEBUG:    starting facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    (fiobj_mem_malloc) total allocations: 0
DEBUG:    finished facil.io memory allocator cleanup for fiobj_mem_malloc.
DEBUG:    testing leaks for fiobj_mem_malloc
DEBUG:    testing leaks for fiobj_mem___malloc_chunk
DEBUG:    testing leaks for fio___cli_amap_s
DEBUG:    testing leaks for fio_cli_help_writer
DEBUG:    testing leaks for fio_cli_ary
DEBUG:    testing leaks for fio_cli_str
FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(0): Success
@boazsegev
Copy link
Member

Sorry I wasn't clear before - but these are the errors I couldn't reproduce.

I don't get the fatal errors from fio___state_map_s.

FYI: most of tests are for performance testing or to test specific behavior. The only truly relevant unit test is the test performed when calling make test.

@kassane
Copy link
Author

kassane commented Sep 29, 2023

In this case it was detected with CMake during the debug build with sanitizers.

cstl/CMakeLists.txt

Lines 237 to 249 in 6bb41f2

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(MSVC)
# Add sanitizers for MSVC
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /fsanitize=address")
else()
# Add sanitizers for GNU compilers (GCC or Clang)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -fstack-protector-all -g -DMALLOC_CHECK_=3 -DTRACE_IS_ON=1 -O0 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -fsanitize=address -fsanitize=undefined")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DEBUG_FLAGS}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RELEASE_FLAGS}")
endif()

@boazsegev
Copy link
Member

Is it possible that the sanitizer is causing the error? such as by rewriting static variables or "marking / erasing" memory during atexit callbacks?

The reason I ask is that the error is actually part of the leak detection code, not the sanitizer...

See:

cstl/fio-stl/001 header.h

Lines 174 to 182 in 0d949a4

FIO_IFUNC size_t FIO_NAME(fio___leak_counter, name)(size_t i) { \
static volatile size_t counter; \
size_t tmp = fio_atomic_add_fetch(&counter, i); \
if (tmp == ((size_t)-1)) \
goto error_double_free; \
return tmp; \
error_double_free: \
FIO_ASSERT(0, FIO_MACRO2STR(name) " `free` after `free` detected!"); \
} \

@kassane kassane changed the title ASan: memory leak on examples and tests FIO_ASSERT: return errno(22) Sep 29, 2023
@kassane
Copy link
Author

kassane commented Sep 29, 2023

I have removed the sanitizers from debug mode (for tests) and the error persists. Also tried use Valgrind and not show mem-leak!

* Testing randomness - bit frequency / hemming distance / chi-square.
WARNING:  unintended fio_mmap allocation (slow): 16777216 bytes
FATAL:    memory allocation failed.
FATAL:         errno(12): Cannot allocate memory

==15749== 
==15749== Process terminating with default action of signal 2 (SIGINT)
==15749==    at 0x4A6794B: kill (syscall-template.S:120)
==15749==    by 0x1508F6: fio___test_stl_random (./fio-stl/902 random.h:472)
==15749==    by 0x11E517: fio_test_dynamic_types (./fio-stl/998 tests finish.h:305)
==15749==    by 0x11E2A7: main (tests/stl.c:15)
==15749== 
==15749== HEAP SUMMARY:
==15749==     in use at exit: 75,472 bytes in 5 blocks
==15749==   total heap usage: 27 allocs, 22 frees, 149,648 bytes allocated
==15749== 
==15749== 80 bytes in 1 blocks are still reachable in loss record 1 of 5
==15749==    at 0x4846BE0: realloc (vg_replace_malloc.c:1649)
==15749==    by 0x48B2EBA: fio___state_map___alloc (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x48B28C5: fio___state_map___expand (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x4865F00: fio___state_map_set (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x4865CF3: fio_state_callback_add (./fio-stl/004 state callbacks.h:160)
==15749==    by 0x48990F2: fio_postoffice_init (./fio-stl/420 pubsub.h:1035)
==15749==    by 0x4004EED: call_init (dl-init.c:90)
==15749==    by 0x4004EED: call_init (dl-init.c:27)
==15749==    by 0x4004FDB: _dl_init (dl-init.c:137)
==15749==    by 0x401B2BF: ??? (in /usr/lib/ld-linux-x86-64.so.2)
==15749== 
==15749== 640 bytes in 1 blocks are still reachable in loss record 2 of 5
==15749==    at 0x4846BE0: realloc (vg_replace_malloc.c:1649)
==15749==    by 0x11F5DA: fio___state_map___alloc (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x11EFE5: fio___state_map___expand (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x11EBD4: fio___state_map_set (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x10D673: fio_state_callback_add (./fio-stl/004 state callbacks.h:160)
==15749==    by 0x118B1C: fio_mem_test_unsafe___mem_state_setup (./fio-stl/010 mem.h:1216)
==15749==    by 0x4A50DFD: call_init (libc-start.c:145)
==15749==    by 0x4A50DFD: __libc_start_main@@GLIBC_2.34 (libc-start.c:347)
==15749==    by 0x10D4D4: (below main) (in /home/kassane/Documentos/cstl/build/stl)
==15749== 
==15749== 16,896 bytes in 1 blocks are still reachable in loss record 3 of 5
==15749==    at 0x4846BE0: realloc (vg_replace_malloc.c:1649)
==15749==    by 0x48D847A: fio___http_mime_map___alloc (./fio-stl/431 http handle.h:2900)
==15749==    by 0x48D8145: fio___http_mime_map___expand (./fio-stl/431 http handle.h:2900)
==15749==    by 0x48A9197: fio___http_mime_map_set (./fio-stl/431 http handle.h:2900)
==15749==    by 0x48A8EEF: fio_http_mimetype_register (./fio-stl/431 http handle.h:2941)
==15749==    by 0x48AA8BE: fio_http_mime_register_essential (./fio-stl/431 http handle.h:3020)
==15749==    by 0x48A9583: fio___http_str_cache_static_builder (./fio-stl/431 http handle.h:3103)
==15749==    by 0x4004EED: call_init (dl-init.c:90)
==15749==    by 0x4004EED: call_init (dl-init.c:27)
==15749==    by 0x4004FDB: _dl_init (dl-init.c:137)
==15749==    by 0x401B2BF: ??? (in /usr/lib/ld-linux-x86-64.so.2)
==15749== 
==15749== 16,896 bytes in 1 blocks are still reachable in loss record 4 of 5
==15749==    at 0x4846BE0: realloc (vg_replace_malloc.c:1649)
==15749==    by 0x14A54A: fio___http_mime_map___alloc (./fio-stl/431 http handle.h:2900)
==15749==    by 0x14A215: fio___http_mime_map___expand (./fio-stl/431 http handle.h:2900)
==15749==    by 0x149B77: fio___http_mime_map_set (./fio-stl/431 http handle.h:2900)
==15749==    by 0x1498CF: fio_http_mimetype_register (./fio-stl/431 http handle.h:2941)
==15749==    by 0x116CAE: fio_http_mime_register_essential (./fio-stl/431 http handle.h:3020)
==15749==    by 0x115973: fio___http_str_cache_static_builder (./fio-stl/431 http handle.h:3103)
==15749==    by 0x4A50DFD: call_init (libc-start.c:145)
==15749==    by 0x4A50DFD: __libc_start_main@@GLIBC_2.34 (libc-start.c:347)
==15749==    by 0x10D4D4: (below main) (in /home/kassane/Documentos/cstl/build/stl)
==15749== 
==15749== 40,960 bytes in 1 blocks are still reachable in loss record 5 of 5
==15749==    at 0x4846BE0: realloc (vg_replace_malloc.c:1649)
==15749==    by 0x11F5DA: fio___state_map___alloc (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x11EFE5: fio___state_map___expand (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x11EBD4: fio___state_map_set (./fio-stl/004 state callbacks.h:129)
==15749==    by 0x10D673: fio_state_callback_add (./fio-stl/004 state callbacks.h:160)
==15749==    by 0x11DEA9: fio___leak_counter_const_fio_big_str_destroy (./fio-stl/200 string.h:1035)
==15749==    by 0x4A50DFD: call_init (libc-start.c:145)
==15749==    by 0x4A50DFD: __libc_start_main@@GLIBC_2.34 (libc-start.c:347)
==15749==    by 0x10D4D4: (below main) (in /home/kassane/Documentos/cstl/build/stl)
==15749== 
==15749== LEAK SUMMARY:
==15749==    definitely lost: 0 bytes in 0 blocks
==15749==    indirectly lost: 0 bytes in 0 blocks
==15749==      possibly lost: 0 bytes in 0 blocks
==15749==    still reachable: 75,472 bytes in 5 blocks
==15749==         suppressed: 0 bytes in 0 blocks
==15749== 
==15749== For lists of detected and suppressed errors, rerun with: -s
==15749== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

running stl:

DEBUG:    testing leaks for fio___cli_amap_s
DEBUG:    testing leaks for fio_cli_help_writer
DEBUG:    testing leaks for fio_cli_ary
DEBUG:    testing leaks for fio_cli_str
FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(22): Invalid argument

release

===============
On Fri, 29 Sep 2023 12:47:17 GMT
Testing PASSED for facil.io core version: 0.8.0-alpha.06

The facil.io library was originally coded by Boaz Segev.
Please give credit where credit is due.
Your support is only fair - give value for value.
(code contributions / donations)

FATAL:    fio___state_map_s `free` after `free` detected!
FATAL:         errno(0): Success

@kassane kassane closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2023
@boazsegev
Copy link
Member

FYI:

On Windows there's a known ordering issue with the atexit / FIO_DESTRUCTOR... this can result in leak testing being performed before some callbacks were called or free being called after the memory allocator was destroyed...

Since the program is exiting anyway (and since Windows is weird) I gave up on trying to fix this issue. I simply moved what I could to the fio_state_callback system and ignored the rest.

So some tests might always report errors on Windows during program exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants