Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Repeated op_batch_create leaks the batch #7262

Closed
mrotteveel opened this issue Aug 15, 2022 · 0 comments
Closed

Repeated op_batch_create leaks the batch #7262

mrotteveel opened this issue Aug 15, 2022 · 0 comments

Comments

@mrotteveel
Copy link
Member

Looking at the code of rem_port::batch_create(P_BATCH_CREATE* batch, PACKET* sendL) in server.cpp, it looks like sending multiple op_batch_create requests for the same statement handle could leak a previously created batch, as it doesn't call statement->rsr_batch->release() before assigning a new batch to statement->rsr_batch.

I see several options:

  1. Check if there is a current batch and return an error
  2. Release the existing batch and allocate a new one
  3. Continue using existing batch, but clear/cancel it if non-empty
  4. A combination, depending on whether or not there is data in the batch (i.e. throw error when non-empty, and either 2 or 3 when empty)

The advantage of 1 or 4 is clarity, the advantage of 2 or 3 is that it allows a client to more easily recover if they lost track of the state of the batch.

# for free to join this conversation on GitHub. Already have an account? # to comment