question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Race condition in test

See original GitHub issue

This seems to be very very rare, found it on Travis today.

$ npm test

> multer@1.0.5 test /home/travis/build/expressjs/multer
> standard && mocha



  Disk Storage
    βœ“ should process parser/form-data POST request
    1) should process empty fields and an empty file
    βœ“ should process multiple files
    βœ“ should remove uploaded files on error
    βœ“ should report error when directory doesn't exist

  Error Handling
    βœ“ should respect parts limit
    βœ“ should respect file size limit
    βœ“ should respect file count limit
    βœ“ should respect file key limit
    βœ“ should respect field key limit
    βœ“ should respect field value limit
    βœ“ should respect field count limit
    βœ“ should respect fields given
    βœ“ should report errors from storage engines
    βœ“ should report errors from busboy constructor
    βœ“ should report errors from busboy parsing

  Expected files
    βœ“ should reject single unexpected file
    βœ“ should reject array of multiple files
    βœ“ should reject overflowing arrays
    βœ“ should accept files with expected fieldname
    βœ“ should reject files with unexpected fieldname

  Express Integration
    βœ“ should work with express error handling (42ms)
    βœ“ should work when receiving error from fileFilter

  Fields
    βœ“ should process multiple fields
    βœ“ should process empty fields
    βœ“ should not process non-multipart POST request
    βœ“ should not process non-multipart GET request
    βœ“ should handle basic keys
    βœ“ should handle multiple values
    βœ“ should handle deeper structure
    βœ“ should handle sparse arrays
    βœ“ should handle even deeper
    βœ“ should handle such deep
    βœ“ should handle merge behaviour
    βœ“ should handle bad fields
    βœ“ should convert arrays into objects

  File Filter
    βœ“ should skip some files
    βœ“ should report errors from fileFilter

  File ordering
    βœ“ should present files in same order as they came

  Functionality
    βœ“ should upload the file to the `dest` dir
    βœ“ should rename the uploaded file
    βœ“ should ensure all req.files values (single-file per field) point to an array
    βœ“ should ensure all req.files values (multi-files per field) point to an array
    βœ“ should rename the destination directory to a different directory

  Issue #232
    βœ“ should report limit errors

  Memory Storage
    βœ“ should process multipart/form-data POST request
    βœ“ should process empty fields and an empty file
    βœ“ should process multiple files

  Reuse Middleware
    βœ“ should accept multiple requests (48ms)

  Select Field
    βœ“ should select the first file with fieldname
    βœ“ should select all files with fieldname

  Unicode
    βœ“ should handle unicode filenames


  51 passing (412ms)
  1 failing

  1) Disk Storage should process empty fields and an empty file:
     Uncaught Error: ENOENT: no such file or directory, stat '/tmp/gvQUuo2Ne54/154080e1a19a860bba7db8c648f4358f'
      at Error (native)
      at Object.fs.statSync (fs.js:849:18)
      at Object.fileSize (test/_util.js:11:13)
      at test/disk-storage.js:81:25
      at Immediate.<anonymous> (test/_util.js:32:37)



npm ERR! Test failed.  See above for more details.

The command "npm test" exited with 1.

Done. Your build exited with 1.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Trottcommented, Dec 18, 2019

The referenced fix in Node core has landed, this should be tested again and determined if it’s fixed for multer.

I haven’t noticed the CITGM failure mentioned in https://github.com/expressjs/multer/issues/238#issuecomment-540915547 in a long time so I’d guess that any Node.js part of this is fixed on the master branch at least.

1reaction
gireeshpunathilcommented, Dec 18, 2019

so closing as resolved; we can always re-open if necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to write tests that check for race conditions?
Race conditions are inherently a result of non-determinism. If you cannot ensure that the calling sequence is secure, then introduce a number of...
Read more >
Race condition testing | Rapita Systems
Race conditions occur in multithreaded software when multiple threads attempt to modify a piece of shared data at the same time.
Read more >
What is a Race Condition? - TechTarget
A race condition is an undesirable situation that occurs when a device or system attempts to perform two or more operations at the...
Read more >
How do you test and demonstrate that you have properly ...
Sometimes you have some control over the timing, and you can intentionally force a race in a test. When you are using a...
Read more >
Data Race Detector - The Go Programming Language
Data races are among the most common and hardest to debug types of bugs in concurrent systems. A data race occurs when two...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found