Print

Print


Using a `XrdOucBuffPool` with the following parameters `minsz=1024` and `maxsz=1024*1024`, the `Alloc` method fails to allocate a buffer of say 1482 bytes since the alignment used when calling `posix_memalign` is not a power of 2. This in turn happens since the size buffer slots used in the XrdOucBuffPool are in their turn not power of two but multiples of the minsz. Therefore, for example, we end up with buffer slots that look like this:
```
(gdb) p bSlot[0]
$10 = {SlotMutex = {cs = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, buffFree = 0x0, size = 1024, numbuff = 0, maxbuff = 16}
(gdb) p bSlot[1]
$11 = {SlotMutex = {cs = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, buffFree = 0x0, size = 2048, numbuff = 0, maxbuff = 16}
(gdb) p bSlot[2]
$12 = {SlotMutex = {cs = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, buffFree = 0x0, size = 3072, numbuff = 0, maxbuff = 14}
(gdb) p bSlot[3]
$13 = {SlotMutex = {cs = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, buffFree = 0x0, size = 4096, numbuff = 0, maxbuff = 13}
(gdb) p bSlot[4]
$14 = {SlotMutex = {cs = {__data = {__lock = 0, __count = 0, __owner = 0, __nusers = 0, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' <repeats 39 times>, __align = 0}}, buffFree = 0x0, size = 5120, numbuff = 0, maxbuff = 12}
(gdb) bt
#0  XrdOucBuffPool::Alloc (this=this@entry=0x7f6db6f61f00 <eos::fst::gOFS+6208>, bsz=1472) at /usr/src/debug/xrootd-4.12.8/src/XrdOuc/XrdOucBuffer.cc:104
```

Notice that the `size` member in the BuffSlot object is used for the `posix_memalign` call as the alignment and this will fail for non-power of two values. This happens with XRootD 4.12.8.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/xrootd/xrootd/issues/1615
You are receiving this because you are subscribed to this thread.

Message ID: <[log in to unmask]>

########################################################################
Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1