[MDEV-28689] Two improper locking bugs in the method compress_write Created: 2022-05-29  Updated: 2022-07-13  Resolved: 2022-07-11

Status: Closed
Project: MariaDB Server
Component/s: Backup
Affects Version/s: 10.9.1
Fix Version/s: 10.3.36, 10.4.26, 10.5.17, 10.6.9, 10.7.5, 10.8.4, 10.9.2

Type: Bug Priority: Major
Reporter: Ryan Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None
Environment:

All


Issue Links:
Problem/Incident
causes MDEV-29043 mariabackup --compress --parallel=4 h... Closed

 Description   

Hi, developers, thank you for your checking. Does it seem the lock ctrl_mutex is not released correctly when writing to the destination stream fails and writing to the destination stream fails in the compress_write?

This is similar to the lock data_mutex, which is acquired in a nearby place. It is not released when writing to the destination stream fails and writing to the destination stream fails in the compress_write.

https://github.com/MariaDB/server/blob/10.9/extra/mariabackup/ds_compress.cc#L234-L261

Thank you for your checking!



 Comments   
Comment by Marko Mäkelä [ 2022-05-29 ]

Thank you for reviewing the code. Do you think that my suggested cleanup related to MDEV-28690 would fix this? It would remove the ctrl_mutex altogether, and simply protect all fields with data_mutex.

Comment by Ryan [ 2022-05-29 ]

I am not familiar with the code, yet I think the patch could fix the bugs. Thank you very much.

Comment by Marko Mäkelä [ 2022-05-30 ]

I am not very familiar with this code either, but I think that simpler code is easier to follow.

Comment by Vladislav Vaintroub [ 2022-07-11 ]

Apprently, this broke --compress entirely, and was pushed without any testing.
It might need to be redone or maybe, we can just ignore the bug since it refers to deprecated --compress interface. I'm going to revert it due to MDEV-29043

Comment by Marko Mäkelä [ 2022-07-11 ]

wlad, sorry, as noted in MDEV-29043, I wrongly assumed that the test mariabackup.compress_qpress would be run somewhere on our CI systems. Fixed again.

Generated at Thu Feb 08 10:02:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.