Skip to content

gbak terminates/crashes when a read error occurs during restore #7996

@ilya071294

Description

@ilya071294

FB5 on Linux.
When os_read function fails to read a backup file, gbak (or the server process in a case of restore via services) terminates/crashes with this backtrace:

#0  0x00007fb90d47541f in raise ()
#1  0x00007fb90d45f895 in abort ()
#2  0x00007fb8fc2ed24f in __gnu_cxx::__verbose_terminate_handler()
#3  0x00007fb8fca28316 in __cxxabiv1::__terminate(void (*)()) ()
#4  0x00007fb8fcac1cc9 in __cxa_call_terminate ()
#5  0x00007fb8fca27fc1 in __gxx_personality_v0 ()
#6  0x00007fb90de353c4 in _Unwind_RaiseException_Phase2 ()
#7  0x00007fb90de35a61 in _Unwind_RaiseException ()
#8  0x00007fb8fca284c7 in __cxa_throw ()
#9  0x00007fb8fc2e3b6a in Firebird::system_call_failed::raise (syscall=0x7fb8fcacb118 "pthread_mutex_destroy", error_code=16)
#10 0x00007fb8fc853d12 in Firebird::Mutex::~Mutex (this=0x7fb783a20138, __in_chrg=<optimized out>)
#11 Burp::IOBuffer::~IOBuffer (this=0x7fb783a200f0, __in_chrg=<optimized out>)
#12 Burp::RestoreRelationTask::~RestoreRelationTask (this=this@entry=0x7fb8bb07d4f0, __in_chrg=<optimized out>)
#13 0x00007fb8fc2da7b1 in (anonymous namespace)::restore (tdgbl=<optimized out>, provider=<optimized out>, file_name=<optimized out>, database_name=<optimized out>)
#14 0x00007fb8fc8ae251 in RESTORE_restore (file_name=file_name@entry=0x7fb78d659960 "backup.fbk", database_name=database_name@entry=0x7fb78d659a20 "database.fdb")
#15 0x00007fb8fc877744 in gbak (uSvc=<optimized out>)
#16 0x00007fb8fc879728 in BURP_main (uSvc=0x7fb862c44340)
#17 0x00007fb8fc556818 in Jrd::Service::run (arg=arg@entry=0x7fb862c44340)
#18 0x00007fb8fc912349 in (anonymous namespace)::ThreadArgs::run (this=<synthetic pointer>)
#19 (anonymous namespace)::threadStart (arg=0x7fb85fe4aa50)
#20 0x00007fb90da6358e in start_thread ()
#21 0x00007fb90d53a2d3 in clone ()

RestoreRelationTask::m_buffers contains 2 buffers, and one of them stayed locked (IOBuffer::m_locked is true). AFAIU, this happend because the buffer was pointed by ioBuf in RestoreRelationTask::fileReader and it was not unlocked when the exception occured.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions