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

prepared statements and non-blocking I/O with external event loop #340

Open
smanolache opened this issue Apr 1, 2019 · 1 comment
Open
Labels
Milestone

Comments

@smanolache
Copy link
Contributor

Hello,

Using prepared statements with an external event loop and non-blocking I/O doesn't seem to work. I'm getting memory corruption problems when repeating the drizzle_stmt_execute call when the first call returned DRIZZLE_RETURN_IO_WAIT.

I've run my code in valgrind and it reports the memory issues:

==13304== Invalid write of size 2
==13304== at 0x48921DC: drizzle_state_result_read (result.cc:477)
==13304== by 0x48921DC: drizzle_state_result_read (result.cc:406)
==13304== by 0x489426C: func (packet.h:108)
==13304== by 0x489426C: current_state (structs.h:379)
==13304== by 0x489426C: drizzle_state_loop (state.cc:56)
==13304== by 0x488E26F: drizzle_command_write (conn.cc:876)
==13304== by 0x4894A0B: drizzle_stmt_execute (statement.cc:299)
...
==13304== Address 0x57bf150 is 2,112 bytes inside a block of size 2,296 free'd
==13304== at 0x483708B: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==13304== by 0x48949DE: drizzle_stmt_execute (statement.cc:292)
...
==13304== Block was alloc'd at
==13304== at 0x483607F: operator new(unsigned long, std::nothrow_t const&) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==13304== by 0x4892262: drizzle_result_create (result.cc:59)
==13304== by 0x488E49C: drizzle_command_write (conn.cc:854)
==13304== by 0x4894A0B: drizzle_stmt_execute (statement.cc:299)

I didn't have problems with drizzle_stmt_prepare but looking at its code I think there are situations in which it would not work either, for example if drizzle_column_skip returned DRIZZLE_RETURN_IO_WAIT.

@bokchan
Copy link
Collaborator

bokchan commented Apr 1, 2019

Hi @smanolache.
Thanks for reporting the issue. I will look into it as soon as possible.

@bokchan bokchan added this to the v6.2.1 milestone Apr 3, 2019
@daniel-zullo daniel-zullo modified the milestones: v6.2.1, v6.2.2 Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants