ilovesoup / hyracks

Automatically exported from code.google.com/p/hyracks
Apache License 2.0
0 stars 0 forks source link

Null pointer dereference in BufferCache #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Create a new BufferCache with slots for N pages
2.  Pin N pages in the buffer cache
3.  Try to pin page N+1

In this situation, BufferCache.findPage() returns null (line 307 in 0.1.8) 
after failing to find a victim several times.  This null value is returned to 
BufferCache.pin() (line 134 in 0.1.8), where either branch of the following 
if.then.else attempts to access cPage.valid triggering a null pointer 
exception. 

This defect persists in the dev_next branch.

Suggested fix:
BufferCache.findPage() should never return null.  It should return a page 
instance or throw a descriptive exception. 

Original issue reported on code.google.com by nbales on 15 Nov 2011 at 11:24

GoogleCodeExporter commented 9 years ago
Thanks for submitting the issue, Nathan! I will look into fixing it. There 
should indeed be a better error message.

Original comment by alexande...@gmail.com on 16 Nov 2011 at 4:30

GoogleCodeExporter commented 9 years ago
Good catch, Nathan! The BC will now throw a more informative exception.

I fixed it locally in my hyracks_btree_updates_next branch. Will go into 
hyracks_dev_next soon, and from there into trunk. Also added a regression test.

Original comment by alexande...@gmail.com on 17 Nov 2011 at 8:54