Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

NFS File close() appears not to await #358

Open
happybeing opened this issue Mar 22, 2019 · 0 comments
Open

NFS File close() appears not to await #358

happybeing opened this issue Mar 22, 2019 · 0 comments

Comments

@happybeing
Copy link

I have a scenario in SAFE Drive where I await on NFS File.close(), and it returns immediately (as if I had not used await). My code (not pushed) looks like this:

  async close (nfs) {
    try {
      this.releaseDescriptor()
      this._flags = undefined
      if (this._fileOpened) await this._fileOpened.close()
      return C.SUCCESS
    } catch (e) { error(e); return e }
    return new Error('Unknown error closing NFS file')
  }

If I break on the line: if (this._fileOpened) await this._fileOpened.close(), set a break on all the following lines in the function and 'run', I break immediately on the closing } of the function. What should happen is that I break at return C.SUCCESS.

This shows that the await on File.close() is not being honoured.

Repeating this in another scenario (reading the file I just created in the above process) the same thing is happening.

Looking at SAFE nodejs code it seems fine in api/emulations/nfs.js: https://github.com/maidsafe/safe_app_nodejs/blob/83a5bc47575270723c2fa748cde104d0ec770250/src/api/emulations/nfs.js#L194-L207

I don't understand the Rust code which is called by the above, so can't say if that might be the reason for this.

Steps to Reproduce (for bugs)

A bit involved, so first thing is for someone to inspect the Maidsafe code. I've looked as far as I can understand and it looks ok, so I suggest someone walk through using their eyes, including into the Rust to see if there is anything obvious before I explain how to do this with a SAFE Drive setup (which also needs me to commit stuff).

Your Environment

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

1 participant