Skip to content
This repository has been archived by the owner on Dec 1, 2024. It is now read-only.

OpenError: IO error: ./tmp/database: Invalid argument #606

Closed
cre8 opened this issue Jul 23, 2018 · 9 comments
Closed

OpenError: IO error: ./tmp/database: Invalid argument #606

cre8 opened this issue Jul 23, 2018 · 9 comments

Comments

@cre8
Copy link

cre8 commented Jul 23, 2018

I use level in a docker container and it worked quite well, but the last days I get an error: (node:16) UnhandledPromiseRejectionWarning: OpenError: IO error: ./tmp/database: Invalid argument at /block/node_modules/levelup/lib/levelup.js:87:23

The folder and files for the database are created. When I change the location to ./database it works, but no more with a location in a subfolder.

@vweevers
Copy link
Member

  • Can you please share code and the output of npm ls levelup leveldown?
  • Does the db reside on a Docker volume? What kind?
  • Does the directory have proper permissions?
  • Is the directory empty?

@cre8
Copy link
Author

cre8 commented Jul 23, 2018

  • Can you please share code and the output of npm ls levelup leveldown?
  • Does the db reside on a Docker volume? What kind?
    I mount a folder in the container. Other ressources from the volume are used correctly.

  • Does the directory have proper permissions?
    The container creates the blockchain folder so i think it has the permission for writing.

  • Is the directory empty?
    The tmp directory exists, but the blockchain folder will be created. Same error when I restart the program without deleting the folder.

@cre8
Copy link
Author

cre8 commented Jul 24, 2018

@vweevers I created a repo to reproduce the steps: https://github.com/cre8/leveldb:

running docker-compose build generator && docker-compose run generator will result:

generator_1  | (node:5) UnhandledPromiseRejectionWarning: OpenError: IO error: ./tmp/mydb: Invalid argument
generator_1  |     at /block/node_modules/levelup/lib/levelup.js:87:23
generator_1  |     at /block/node_modules/abstract-leveldown/abstract-leveldown.js:41:14
generator_1  |     at /block/node_modules/deferred-leveldown/deferred-leveldown.js:20:21
generator_1  |     at /block/node_modules/abstract-leveldown/abstract-leveldown.js:41:14
generator_1  |     at /block/node_modules/abstract-leveldown/abstract-leveldown.js:41:14
generator_1  | (node:5) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
generator_1  | (node:5) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
leveldb_generator_1 exited with code 0

Even when the tmp folder does not exist yet docker will create and use it

@vweevers
Copy link
Member

Ah, you're using alpine? IIRC leveldown doesn't support it, in the past I had to do npm i --build-from-source.

@vweevers
Copy link
Member

See Level/leveldown#388

@cre8
Copy link
Author

cre8 commented Jul 24, 2018

I don't think that alpine is the problem: I used the image for some weeks and it worked pretty well. I changed the image to a normal node one:

FROM node:8

WORKDIR block

COPY package*.json ./

RUN npm install --build-from-source

COPY index.js .

ENTRYPOINT node index.js        

still the same error...

@vweevers
Copy link
Member

OK. Well if anything, --build-from-source will prevent segfaults to that's one thing out of the way.

At a quick glance, your setup looks good otherwise. Will need more time to investigate.

@ralphtheninja
Copy link
Member

@cre8 Did you manage to solve this or is this still an issue? Please re-open if needed.

@cre8
Copy link
Author

cre8 commented Dec 18, 2018

@ralphtheninja I found a solution, but I can't remember the fixes I made to fix it...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants