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

Fix 'conditional jump or move depends on uninitialised value(s)' detected by Valgrind #3458

Closed
5 tasks done
JavierJF opened this issue May 21, 2021 · 0 comments · Fixed by #3459
Closed
5 tasks done

Comments

@JavierJF
Copy link
Collaborator

JavierJF commented May 21, 2021

  • A clear description of the issue

Valgrind reported a series of 'conditional jump or move depends on uninitialised value(s)' during testing, relevant ones include:

==961522== 4 errors in context 18 of 55:
==961522== Conditional jump or move depends on uninitialised value(s)
==961522==    at 0x8C84EB: Command_Counter::_add_idx(unsigned long long) (query_processor.h:213)
==961522==    by 0x8C875B: Command_Counter::add_time(unsigned long long) (query_processor.h:240)
==961522==    by 0x8C13FA: Query_Processor::query_parser_update_counters(MySQL_Session*, MYSQL_COM_QUERY_command, __SQP_query_parser_t*, unsigned long long) (Query_Processor.cpp:1906)
==961522==    by 0x8479A5: Query_Info::query_parser_update_counters() (MySQL_Session.cpp:304)
==961522==    by 0x847457: Query_Info::end() (MySQL_Session.cpp:249)
==961522==    by 0x885A1F: MySQL_Session::RequestEnd(MySQL_Data_Stream*) (MySQL_Session.cpp:6773)
==961522==    by 0x86F8C4: MySQL_Session::handler() (MySQL_Session.cpp:4565)
==961522==    by 0x8168A8: MySQL_Thread::process_all_sessions() (MySQL_Thread.cpp:4927)
==961522==    by 0x813469: MySQL_Thread::run() (MySQL_Thread.cpp:4445)
==961522==    by 0x6AEFB0: mysql_worker_thread_func(void*) (main.cpp:789)
==961522==    by 0x4A78298: start_thread (in /usr/lib/libpthread-2.33.so)
==961522==    by 0x4EF9052: clone (in /usr/lib/libc-2.33.so)
==961522==  Uninitialised value was created by a heap allocation
==961522==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==961522==    by 0x84801D: MySQL_Session::operator new(unsigned long) (MySQL_Session.cpp:421)
==961522==    by 0x80F9E7: MySQL_Thread::create_new_session_and_client_data_stream(int) (MySQL_Thread.cpp:3958)
==961522==    by 0x819F0F: MySQL_Thread::listener_handle_new_connection(MySQL_Data_Stream*, unsigned int) (MySQL_Thread.cpp:5245)
==961522==    by 0x811D18: MySQL_Thread::ProcessAllMyDS_AfterPoll() (MySQL_Thread.cpp:4185)
==961522==    by 0x8132F5: MySQL_Thread::run() (MySQL_Thread.cpp:4429)
==961522==    by 0x6AEFB0: mysql_worker_thread_func(void*) (main.cpp:789)
==961522==    by 0x4A78298: start_thread (in /usr/lib/libpthread-2.33.so)
==961522==    by 0x4EF9052: clone (in /usr/lib/libc-2.33.so)
==961522== 
==961522== 
==961522== 54 errors in context 19 of 55:
==961522== Thread 12:
==961522== Conditional jump or move depends on uninitialised value(s)
==961522==    at 0x8B1D9B: QP_query_digest_stats::add_time(unsigned long long, unsigned long long, unsigned long long, unsigned long long) (Query_Processor.cpp:191)
==961522==    by 0x8C208B: Query_Processor::update_query_digest(__SQP_query_parser_t*, int, MySQL_Connection_userinfo*, unsigned long long, unsigned long long, MySQL_STMT_Global_info*, MySQL_Session*) (Query_Processor.cpp:1978)
==961522==    by 0x8C194D: Query_Processor::query_parser_update_counters(MySQL_Session*, MYSQL_COM_QUERY_command, __SQP_query_parser_t*, unsigned long long) (Query_Processor.cpp:1935)
==961522==    by 0x8479A5: Query_Info::query_parser_update_counters() (MySQL_Session.cpp:304)
==961522==    by 0x847457: Query_Info::end() (MySQL_Session.cpp:249)
==961522==    by 0x885A1F: MySQL_Session::RequestEnd(MySQL_Data_Stream*) (MySQL_Session.cpp:6773)
==961522==    by 0x86F8C4: MySQL_Session::handler() (MySQL_Session.cpp:4565)
==961522==    by 0x8168A8: MySQL_Thread::process_all_sessions() (MySQL_Thread.cpp:4927)
==961522==    by 0x813469: MySQL_Thread::run() (MySQL_Thread.cpp:4445)
==961522==    by 0x6AEFB0: mysql_worker_thread_func(void*) (main.cpp:789)
==961522==    by 0x4A78298: start_thread (in /usr/lib/libpthread-2.33.so)
==961522==    by 0x4EF9052: clone (in /usr/lib/libc-2.33.so)
==961522==  Uninitialised value was created by a heap allocation
==961522==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==961522==    by 0x84801D: MySQL_Session::operator new(unsigned long) (MySQL_Session.cpp:421)
==961522==    by 0x80F9E7: MySQL_Thread::create_new_session_and_client_data_stream(int) (MySQL_Thread.cpp:3958)
==961522==    by 0x819F0F: MySQL_Thread::listener_handle_new_connection(MySQL_Data_Stream*, unsigned int) (MySQL_Thread.cpp:5245)
==961522==    by 0x811D18: MySQL_Thread::ProcessAllMyDS_AfterPoll() (MySQL_Thread.cpp:4185)
==961522==    by 0x8132F5: MySQL_Thread::run() (MySQL_Thread.cpp:4429)
==961522==    by 0x6AEFB0: mysql_worker_thread_func(void*) (main.cpp:789)
==961522==    by 0x4A78298: start_thread (in /usr/lib/libpthread-2.33.so)
==961522==    by 0x4EF9052: clone (in /usr/lib/libc-2.33.so)

  • ProxySQL version

  • v2.1.1

  • OS version

NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
  • The steps to reproduce the issue

To reproduce the behavior it's required to create a flow in which the variables:

	unsigned long long start_time;
	unsigned long long end_time;

Remains uninitialized when are being accessed for counter update.

  • Full valgrind log

valgrind-log-3458.txt

renecannao added a commit that referenced this issue May 26, 2021
Closes #3458: Fix 'conditional jump or move depends on uninitialised value(s)' detected by Valgrind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant