getappmap / appmap-js

Client libraries for AppMap
49 stars 17 forks source link

`EACCES: permission denied` causes indexer to exit with exit code 1 #899

Closed ahtrotta closed 1 year ago

ahtrotta commented 1 year ago

Here's%20and%20session_Id%20%3D%3D%20%22e655af7b-8018-4062-950a-24bf8336bff91670562802093%22%7C%20extend%20logLen%3Dstrlen(customDimensions%5B%22appmap.cli.log%22%5D)%2Clog%3DcustomDimensions%5B%22appmap.cli.log%22%5D%2Cexception%3DcustomDimensions%5B%22appmap.debug.exception%22%5D%7C%20project-reorder%20timestamp%2Cname%2Cuser_Id%2ClogLen%2Clog%2Cexception) an example:

Error: EACCES: permission denied, scandir '/path/'
Emitted 'error' event on Glob instance at:
    at Glob._readdirError (/path/Code/User/globalStorage/appland.appmap/node_modules/glob/glob.js:610:14)
    at /path/.config/Code/User/globalStorage/appland.appmap/node_modules/glob/glob.js:553:12
    at FSReqCallback.oncomplete (node:fs:188:23) {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/path/'
}
symwell commented 1 year ago

The log above is for the indexer, for which there's an existing resolved issue, not the scanner. Was able to reproduce this error for the scanner.

I expected to find a scandir system call as the one shown in the log but observed a watch system call. It could be because the log message above was for the indexer, not the scanner. Disabling the watcher to leave only the poller running didn't produce an EACCES error. Hardcoding an inaccessible this.options.configFile produced an EACCES error for a stat system call

$ yarn run scanner scan --watch --appmap-dir ~/tmp/permission_denied
Using scanner configuration file /home/test/src/appmap-js/packages/scanner/built/sampleConfig/default.yml
configfile is /home/test/tmp/permission_denied/minitest/User_should_be_valid/appmap-scanner.yml
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: EACCES: permission denied, stat '/home/test/tmp/permission_denied/minitest/User_should_be_valid/appmap-scanner.yml'
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (/home/test/src/appmap-js/node_modules/chokidar/index.js:647:10)
    at NodeFsHandler._addToNodeFs (/home/test/src/appmap-js/node_modules/chokidar/lib/nodefs-handler.js:645:18)
    at async /home/test/src/appmap-js/node_modules/chokidar/index.js:451:21
    at async Promise.all (index 0) {
  errno: -13,
  code: 'EACCES',
  syscall: 'stat',
  path: '/home/test/tmp/permission_denied/minitest/User_should_be_valid/appmap-scanner.yml'
}

Node.js v18.8.0
ahtrotta commented 1 year ago

Okay, I re-named the issue, thanks!

appland-release commented 1 year ago

:tada: This issue has been resolved in version @appland/scanner-v1.74.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: