iverase edited a comment on pull request #541:
URL: https://github.com/apache/lucene/pull/541#issuecomment-1019443628


   I tried to reproduce the issue in another machine again and I was able to. 
In addition I was able to run it as well successfully, the difference between 
the two runs is that in the successful one I got this warning message:
   
   ```
   WARNING: Unmapping is not supported, because Lucene cannot read 
'jdk.unsupported' module [please add 'jdk.unsupported' to modular application 
either by command line or its module descriptor]
   ```
   
   So you need to make sure you can run MMAP (maybe you need to add 
`--add-modules jdk.unsupported`) which points to the readInts implementation in 
`ByteBufferIndexInput`. Just a quick check by removing the implementation shows 
that the error disappears.
   
   I had a look into the method and I could not spot anything strange. More 
over, I replaced the line:
   
   ```
   guard.getInts(curIntBufferViews[position & 0x03].position(position >>> 2), 
dst, offset, length);
   ```
   
   with: (Not reusing the int buffers)
   
   ```
   IntBuffer intBuffer = 
curBuf.duplicate().order(ByteOrder.LITTLE_ENDIAN).position(position).asIntBuffer();
   guard.getInts(intBuffer, dst, offset, length);
   ```
   
   And the error disappear. ~~Not sure what is going on, maybe a jdk bug?~~
   
   EDIT: I see you found it, we were not reseting the views when setting a new 
cur buffer.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to