Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fibers Error On Upload #147

Open
ghost opened this issue Apr 20, 2021 · 5 comments
Open

Fibers Error On Upload #147

ghost opened this issue Apr 20, 2021 · 5 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2021

Hi

Thanks for this still really useful package. Working with Meteor 2.2, I've recognized the following error when uploading a file:

W20210420-12:07:58.007(2)? (STDERR) ufs: cannot delete temp file "/tmp/uploads/eSnyvJNSTSK52QHnW" (ENOENT: no such file or directory, unlink '/tmp/uploads/eSnyvJNSTSK52QHnW')
I20210420-12:07:58.012(2)? Exception in callback of async function: Error: Future resolved more than once
I20210420-12:07:58.012(2)?     at Future.return (/home/oprobst/.meteor/packages/meteor-tool/.2.2.0.tbd8u8.zkor8++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:261:10)
I20210420-12:07:58.013(2)?     at packages/jalik:ufs/ufs-methods.js:104:13
I20210420-12:07:58.013(2)?     at runWithEnvironment (packages/meteor.js:1286:24)
I20210420-12:07:58.013(2)?     at GridFSStore.<anonymous> (packages/meteor.js:1299:14)
I20210420-12:07:58.013(2)?     at packages/jalik:ufs/ufs-store.js:290:22
I20210420-12:07:58.013(2)?     at runWithEnvironment (packages/meteor.js:1286:24)

I think it is happening in ufs-methods.js in line 66:

 const removeTempFile = function () {
        fs.unlink(tmpFile, function (err) {
          err && console.error(`ufs: cannot delete temp file "${tmpFile}" (${err.message})`);
        });
      };

Any hints what to do?

Thanks so much.
Oliver

@jalik
Copy link
Owner

jalik commented Apr 20, 2021

Hello, maybe your server restarted during the upload, leaving a temp file in database, but not in the /tmp directory which is cleared on every system reboot. You just have to remove the temp file from mongodb OR create a fake file at the given location like touch /tmp/uploads/eSnyvJNSTSK52QHnW.

@ghost
Copy link
Author

ghost commented Apr 21, 2021

Thanks for the quick reply. Hmm. I had this kind of behaviour some time ago but now after updating several libs it happens for every upload...

@isibz
Copy link

isibz commented May 21, 2021

Hello, I've got the same problem with meteor 2.2 and GridFs Store

any clue?

STDERR) ufs: cannot delete temp file "/tmp/ufs/uPy5LmNCML8nsDjeo" (ENOENT: no such file or directory, unlink '/tmp/ufs/uPy5LmNCML8nsDjeo')
I20210521-18:46:24.144(2)? Exception in callback of async function: Error: Future resolved more than once
I20210521-18:46:24.144(2)? at Future.return (/home/isibz/.meteor/packages/meteor-tool/.2.2.0.12upnqr.xtrd++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:261:10)
I20210521-18:46:24.144(2)? at packages/jalik:ufs/ufs-methods.js:104:13
I20210521-18:46:24.144(2)? at runWithEnvironment (packages/meteor.js:1286:24)
I20210521-18:46:24.144(2)? at GridFSStore. (packages/meteor.js:1299:14)
I20210521-18:46:24.144(2)? at packages/jalik:ufs/ufs-store.js:290:22
I20210521-18:46:24.145(2)? at runWithEnvironment (packages/meteor.js:1286:24)

@jdme
Copy link

jdme commented Nov 29, 2021

Hello everyone! I encountered the same problem and made a research. It's happening while you're using ufs-gridfs storage with a modern version of Meteor (I think from v2.4, not sure).

Here is the problem and issue:

Since v3.6.6 of npm mongodb library gridfs-stream emits close event along with finish event. The behaviour is changed by this commit. But in your jalik:ufs-gridfs library finish event emitting manually after close here, as a result we have finish event emitted 2 times.

So at this moment to work properly npm-mongo package of meteor should be at version v3.8.1 or less, since it depends on older version of mongodb.

It's the reason why deleting of tmp file runs twice here.

@kartboy16
Copy link

kartboy16 commented Feb 14, 2022

@jdme Are you still running Meteor 2.1? I tried upgrading to Meteor 2.6 and uploads and reads no longer work.
@jalik I know this is no longer a priority but any plans on updating to be compatible with Meteor 2.6/MongoDB 5.0?

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

No branches or pull requests

4 participants