Skip to content

Occasional fwrite errors using file-based stores #381

@zfj1

Description

@zfj1

Bug Report

Description

Inserting into a store using the file protocol occasionally causes an error in fwrite.

Reproducibility

  • OS WIN
  • MATLAB Version 2020b
  • MySQL Version 8.0.20
  • MySQL Deployment Strategy remote
  • DataJoint Version 3.4.1
  • Minimum number of steps to reliably occasionally reproduce the issue:
my_schema.MyStoreBasedTable().insert({'my_pk', 'my_blob'});
  • Complete error stack as a result of evaluating the above steps:
Error using fwrite
Invalid file identifier. Use fopen to generate a valid file identifier.

Error in dj.store_plugins.File.upload_buffer (line 57)
            fwrite(fileID, buffer);

Error in dj.internal.ExternalTable/upload_buffer (line 116)
            self.spec.upload_buffer(packed_cell{1}, self.make_uuid_path(uuid, ''));

Error in dj.Relvar/insert/makePlaceholder (line 420)
                        value = self.schema.external.table(...

Error in dj.Relvar/insert (line 499)
                    [v, placeholder] = makePlaceholder(i, tuple.(header.attributes(i).name));

Expected Behavior

Successful insertion

Screenshots

N/A

Additional Research and Context

This often happens in the middle of inserting many entries into a store-based table, causing the transaction to fail. It then will often work after re-running the insertion.

Our store is on a mounted network drive, so it's possible that momentary disconnections from the file server are at play, but I would think this is probably a common use case. (Note that our file server and db server are on the same network). A simple solution may just entail retrying the file creation on failure.

It would also be convenient to disable the 'directory already exists warning' using warning('off','MATLAB:MKDIR:DirectoryExists')

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting-triageIssues awaiting proper priority/milestone assignment.bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions