Skip to content

Errors

Class Base Raised when
SegmentExistsError FileExistsError creating a box or a stream under a name that is already taken
SegmentNotFoundError FileNotFoundError attaching to, or unlinking on Linux, a name with no segment, whether it holds a box or a stream; attaching to shared memory that does not become a box or a stream within 1 s
SchemaMismatchError TypeError attaching, or unpickling a box, with a class whose identity or fields differ from the creator's; a segment of another core or layout major version; a segment whose magic this version does not know, which another version of sharedbox made or which is not a sharedbox segment; a segment with a field of a kind this version cannot read; unpickling after the box was created again; attaching a stream with another item type than the creator's; a lossless reader finding that the sender overwrote an item it had not read
KindMismatchError SchemaMismatchError attaching a box to a name that holds a stream, or a stream to a name that holds a box
RequestError Exception waiting on a request whose handler raised, whose server stopped while handling it, or whose answer four later answers replaced
RequestRefused Exception raised by a request handler to refuse a request, which fails for its caller and leaves no log record
RequestSupersededError RequestError waiting on a request that a later request replaced before the server took it
ServerExitedError RequestError waiting on a request whose server's process ended
AlreadyServedError RuntimeError serving an attribute that a live process serves already, this one included
BoxClosedError ValueError using a box after close(), or waiting for its lock while another thread closes it
LockTimeoutError TimeoutError a read or write waits for a write in progress for longer than lock_timeout
BrokenReferenceError LookupError reading a reference field, or snapshot(follow=True), when the box it refers to was removed or created again since it was assigned
UnknownBoxClassError TypeError reading a reference field, or snapshot(follow=True), when no class this process has defined has the stored box's schema hash
MetadataFullError RuntimeError adding metadata to a box or stream created without room for it, or by a version of sharedbox without metadata; adding a version to a stream while an item still in its ring was sent under the version the add would let go
MetadataGoneError LookupError reading a metadata version that the box or stream no longer holds, or never held; reading a reader's metadata when the version its last item was sent under is gone
WouldBlock Exception a _nowait call on a stream finds nothing to receive or no room to send
EndOfStream Exception receiving from a stream whose sender closed or died after every item was received; asking for the sender of a stream that has ended
ReaderReleased Exception receiving on a lossless reader that a sender opened with on_full="release" stopped waiting for; the reader goes on at the newest item, see released reader
ItemGoneError LookupError fetching an item of a stream that the ring no longer holds, because the sender wrote a later item over it
StreamBusyError RuntimeError asking for the sender of a stream while another live sender exists
StreamClosedError ValueError using a stream, sender or reader after close(), or waiting in one that is closed meanwhile
WaiterSlotsFullError RuntimeError opening a reader of a stream that has max_readers readers open or no free waiter slot; a box never raises it and checks for changes once a second instead

AlreadyServedError

Bases: RuntimeError

A live process serves the field already, this one included.

BoxClosedError

Bases: ValueError

The segment handle has been closed.

Raised by using a box after close.

BrokenReferenceError

Bases: LookupError

The box a reference field refers to no longer exists, or was created again.

Raised by reading a reference field, or by snapshot(follow=True), when the box was removed, or removed and created again, since it was assigned. The message names the field, the box and which of the two happened.

KindMismatchError

Bases: SchemaMismatchError

The name holds a segment of another kind, such as a stream where a box was asked for.

The message names both kinds.

LockTimeoutError

Bases: TimeoutError

The write lock stayed taken for longer than the lock timeout.

Raised by a read or write that waits for a write in progress for longer than the class's lock_timeout. The message names the process that holds the lock.

MetadataFullError

Bases: RuntimeError

A new metadata document cannot be stored now.

Raised by adding metadata to a segment without a metadata area (created with no capacity, or by an older release of sharedbox), or, in a stream, while the ring still holds items sent under the version the add would overwrite.

MetadataGoneError

Bases: LookupError

The metadata version asked for was reclaimed for newer ones, or never added.

RequestError

Bases: Exception

The request failed: the handler raised, the server stopped, or four later answers overwrote its answer.

RequestRefused

Bases: Exception

Raised by a request handler to refuse a request without a log record.

The caller gets RequestError with this exception's type and message, as for any exception a handler raises; the serving process logs nothing for it.

RequestSupersededError

Bases: RequestError

A later request replaced this one before the server took it.

SchemaMismatchError

Bases: TypeError

The segment was created by a different class or layout.

Raised by attaching, or unpickling a box, with a class whose identity or fields differ from the creator's; by a segment of another layout major version, with a field of a kind this version cannot read, or with an unknown magic (a segment made by another version of sharedbox, or not a sharedbox segment), which the message names; and by unpickling after the box was created again.

SegmentExistsError

Bases: FileExistsError

A segment with that name already exists.

Raised by creating a box under a name that is taken. The message says which case it is:

  • the box's creator is still running, with its pid;
  • the box is still being created: its creator is running and has not returned from __post_init__ yet. The message gives its pid and says to wait for it or use another name;
  • the creator runs in another pid namespace, such as another container;
  • the creator is no longer running. On Linux the box is then probably left over from a crash, and unlink(name) on its class removes it. On Windows a process, possibly this one, still has the box open, and the name is freed when every handle to it is closed;
  • the name holds no published box. On Linux it may be left over from a crash during creation, and unlink(name) on its class removes it. On Windows a process, possibly this one, still has something open under that name, and the name is freed when every handle to it is closed.

When none of these can be told, the message only says the name is taken. Nothing is removed automatically.

SegmentNotFoundError

Bases: FileNotFoundError

No segment has that name.

Raised by attaching to, or unlinking on Linux, a name with no segment, and by attaching to shared memory that does not become a box within 1 s.

ServerExitedError

Bases: RequestError

The process serving the field ended while the request waited.

UnknownBoxClassError

Bases: TypeError

No class defined in this process has the schema hash of the box a reference field refers to.

Raised by reading a reference field, or by snapshot(follow=True). The message names the field, the box and the hash, and says to import the module that defines the class.

WaiterSlotsFullError

Bases: RuntimeError

A stream has max_readers readers open, or has no free waiter slot.

EndOfStream

Bases: Exception

The stream's sender closed or died and every item it sent was received.

ItemGoneError

Bases: LookupError

The stream's ring no longer holds the item at a position; the sender wrote a later item over it.

Attributes:

Name Type Description
oldest int

The oldest position the ring held when the fetch checked. The sender may have overwritten it too by the time it is read.

ReaderReleased

Bases: Exception

The sender released a lossless reader that held it back; the reader goes on at the newest item.

Attributes:

Name Type Description
missed int

The items this reader lost to the release.

StreamBusyError

Bases: RuntimeError

Another live end holds the stream's sender.

StreamClosedError

Bases: ValueError

A stream or one of its ends used after close(), or in a child of fork.

WouldBlock

Bases: Exception

A non-blocking stream call that would have had to wait.