Skip to content

Commit

Permalink
Prevent debug logging panic when mapping fails
Browse files Browse the repository at this point in the history
  • Loading branch information
grddev authored and aayushduwadi committed Jun 6, 2024
1 parent 7530b4c commit e5cc92d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions aeron/util/memmap/memmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func MapExisting(filename string, offset int64, length int) (*File, error) {

logger.Debugf("Mapping existing file: fd: %d, size: %d, offset: %d", f.Fd(), size, offset)
mmap, err := doMap(f, offset, mapSize)
if err != nil {
return nil, err
}
logger.Debugf("Mapped existing file @%v for %d", mmap.mmap, mmap.size)

return mmap, err
Expand All @@ -112,6 +115,9 @@ func NewFile(filename string, offset int64, length int) (*File, error) {
}

mmap, err := doMap(f, offset, length)
if err != nil {
return nil, err
}
logger.Debugf("Mapped a new file @%v for %d", mmap.mmap, mmap.size)

return mmap, err
Expand Down

0 comments on commit e5cc92d

Please sign in to comment.