Skip to content

ValueError: offset must be zero or positive #251

Closed
@cachedout

Description

@cachedout

Hello,

I have an error that seems to occur occasionally that I'm trying to track down.

First, some versions:

Python 2.7
GitPython: 0.3.6

At times, calling the stream_data method with a file handle on a blob object produces the following:

  File "/testing/salt/fileserver/gitfs.py", line 1314, in find_file
    blob.stream_data(fp_)
  File "/usr/lib/python2.7/site-packages/GitPython-0.3.6-py2.7.egg/git/objects/base.py", line 119, in stream_data
    istream = self.repo.odb.stream(self.binsha)
  File "/usr/lib/python2.7/site-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg/gitdb/db/base.py", line 208, in stream
    return self._db_query(sha).stream(sha)
  File "/usr/lib/python2.7/site-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg/gitdb/db/pack.py", line 104, in stream
    return entity.stream_at_index(index)
  File "/usr/lib/python2.7/site-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg/gitdb/pack.py", line 778, in stream_at_index
    return self._object(None, True, index)
  File "/usr/lib/python2.7/site-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg/gitdb/pack.py", line 731, in _object
    streams = self.collect_streams_at_offset(offset)
  File "/usr/lib/python2.7/site-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg/gitdb/pack.py", line 865, in collect_streams_at_offset
    streams = self._pack.collect_streams(offset)
  File "/usr/lib/python2.7/site-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg/gitdb/pack.py", line 607, in collect_streams
    ostream = pack_object_at(c, offset, True)[1]
  File "/usr/lib/python2.7/site-packages/gitdb-0.6.4-py2.7-linux-x86_64.egg/gitdb/pack.py", line 92, in pack_object_at
    data = cursor.use_region(offset).buffer()
  File "build/bdist.linux-x86_64/egg/smmap/mman.py", line 158, in buffer
    return buffer(self._region.buffer(), self._ofs, self._size)
ValueError: offset must be zero or positive

As you can see, the traceback begins with a call from the SaltStack fileserver. (I am one of the developers there.)

As mentioned earlier, I can only reproduce this on occasion. I can attempt to gather debugging values as needed, though it will be a little tricky. :]

I would also happily accept any theories about reasons this might happen which are only tangentially related to GitPython (locked files, half-written files, etc). Those shouldn't be ruled out, as this error is produced during our automated integration testing, which creates and destroys git repos for each test case.

Many thanks for any leads or advice. Let me know how I can help. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions