Skip to content

Conversation

hvlad
Copy link
Member

@hvlad hvlad commented Mar 14, 2021

Fixed bug CORE-5515

hvlad added 3 commits March 14, 2021 01:56
…it platforms as its instances is used in shared memory.

It fixed bug CORE-5515 : When 32bit and 64bit FB 3 servers run on one Windows machine concurrently, Firebird services freeze several minutes after first disconnect.
@hvlad hvlad self-assigned this Mar 14, 2021
if (sMem->mhb_type != SharedMemoryBase::SRAM_MAPPING_RESET ||
sMem->mhb_header_version != MemoryHeader::HEADER_VERSION ||
sMem->mhb_version != MAPPING_VERSION)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to access mhb_* members without a mutex acquired? What if shmem is being initialized by another process right at the moment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shmem is not accesible by other processes while it is initialized.
Also, note, on non-Windows - shmem contains mutex that should be acquired - should we access it when shmem binary layout is not known\verified ?
And, finally - former fb_assert() does the same - check before muex is acquired ;)

@hvlad
Copy link
Member Author

hvlad commented Mar 14, 2021

@hvlad for master, can't just use alignas?

Yes, we can. But I consider old-style union way is more clear\explicit at this place.
With union it is explicitly clear that last member occupy 8 bytes, while with alignas it is far not that obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When 32bit and 64bit FB 3 servers run on one Windows machine concurrently, Firebird services freeze several minutes after first disconnect. [CORE5515]
3 participants