> > > > > > that my linked list allocation file-backed strategy
> > > > > >
> > > > > > is __full of bugs densely__

> > > > > now i like bugs. all my life i loved insects! i was a nerdy introvert

> on to the software bugs

here is i.py right now, i'm trying to kind of direct my logic turmoil
to slowly improve it

here is the current backtrace:

  File 
"/nix/store/f2krmq3iv5nibcvn4rw7nrnrciqprdkh-python3-3.12.9/lib/python3.12/pdb.py",
line 1754, in _run
    self.run(target.code)
  File 
"/nix/store/f2krmq3iv5nibcvn4rw7nrnrciqprdkh-python3-3.12.9/lib/python3.12/bdb.py",
line 627, in run
    exec(cmd, globals, locals)
  File "/home/karl3/projects/rep/rep/array.py", line 138, in <module>
    doc[:] = b''
    ~~~^^^
  File "/home/karl3/projects/rep/rep/array.py", line 111, in __setitem__
    dealloc(old_id)
  File "/home/karl3/projects/rep/rep/i.py", line 36, in dealloc
    self.fsck()
  File "/home/karl3/projects/rep/rep/i.py", line 114, in fsck
    assert l8 <= self.yq - addr8

somehow it seems after a dealloc that the store became inconsistent.

(Pdb) list
 31             addr8 = memoryview(id).cast('Q')[0]
 32             l8 = max((self.q[addr8]+self.idsize-1)//self.idsize,1) + 1
 33             self.q[addr8] = self.q[0]
 34             self.q[addr8+1] = l8
 35             self.q[0] = addr8
 36  ->         self.fsck()
 37         def alloc(self, data, replacing=[]):
 38             self.fsck()
 39             l8 = max((len(data)+self.idsize-1)//self.idsize,1) + 1
 40             addr8 = 0
 41             assert self.q[addr8] != 0
(Pdb) p addr8
1
(Pdb) p id
b'\x01\x00\x00\x00\x00\x00\x00\x00'
(Pdb) p self.q[addr8]
11
(Pdb) p l8
4
(Pdb) p addr8
1
(Pdb) p l8
4
(Pdb) p self.w[addr8*self.idsize:addr8+self.idsize+4*self.idsize]
<memory at 0x7f0a3b9d9840>
(Pdb) p self.w[addr8*self.idsize:addr8+self.idsize+4*self.idsize].tobytes()
b'\x0b\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00k
brown fox jum\x00\t'

the 'k brown fox jum' content looks believable. additionally, the fsck
prior to the deallocation passed [ :S ]

Attachment: i.py
Description: Binary data

Reply via email to