jw3 / example-daffodil-vscode

A VS Code extension for DFDL with Daffodil
Apache License 2.0
2 stars 3 forks source link

Use Path/File vs URI to refer to schemas. #121

Closed arosien closed 2 years ago

arosien commented 2 years ago

Fixes #119.

arosien commented 2 years ago

@jw3 can you try this out?

jw3 commented 2 years ago

Different format but errors

15:01:53.911 [io-compute-3] DEBUG org.apache.daffodil.debugger.dap.Parse - deliverParseData: Errored(java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:/c:/Users/wassj/Downloads/test-dfdl-workspace/jpeg.dfdl.xsd)
arosien commented 2 years ago

Different format but errors

15:01:53.911 [io-compute-3] DEBUG org.apache.daffodil.debugger.dap.Parse - deliverParseData: Errored(java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:/c:/Users/wassj/Downloads/test-dfdl-workspace/jpeg.dfdl.xsd)

To be paranoid, are you sure you're using the code from this branch?

jw3 commented 2 years ago

To be paranoid, are you sure you're using the code from this branch?

Now you are just trying to scare me.... Let's see...

arosien commented 2 years ago

To be paranoid, are you sure you're using the code from this branch?

Now you are just trying to scare me.... Let's see...

There should be a git hash printed as part of the startup of DAPodil.

jw3 commented 2 years ago

I installed https://github.com/jw3/example-daffodil-vscode/releases/tag/v0.0.15-pre4

Which has commits https://github.com/jw3/example-daffodil-vscode/commits/v0.0.15-pre4

I restarted vs code just to be sure, the extension info page claims 0.0.15-pre4

Build info:
  version: 0.0.15-pre4
  daffodilVersion: 3.1.0
  scalaVersion: 2.12.13
  sbtVersion: 1.5.1
jw3 commented 2 years ago

hmm I dont see a git commit id anywhere

arosien commented 2 years ago

hmm I dont see a git commit id anywhere

oh, it's probably not there because you're installing off a tag, sorry

arosien commented 2 years ago

@jw3 i pushed a thing to dump a stack trace when that path is hit, can you cut a new release and try it for me?

arosien commented 2 years ago

we really need a live chat mechanism... :)

jw3 commented 2 years ago
16:18:41.999 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPodil -
******************************************************
A DAP server for debugging Daffodil schema processors.

Build info:
  version: 0.0.15-pre5
  daffodilVersion: 3.1.0
  scalaVersion: 2.12.13
  sbtVersion: 1.5.1

Built off commit 753a104 at 2021-08-31 20:06:32.173.
******************************************************
16:18:42.004 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPodil - launched with options listenPort: 4711, listenTimeout: 10 seconds
16:18:42.030 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPodil - waiting at tcp://0.0.0.0:4711
16:18:45.086 [io-compute-2] INFO org.apache.daffodil.debugger.dap.DAPodil - connected at tcp://0.0.0.0:4711
16:18:45.369 [io-compute-1] INFO org.apache.daffodil.debugger.dap.DAPSession - R> #1 initialize {"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"dfdl","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true}
16:18:45.561 [io-compute-3] INFO org.apache.daffodil.debugger.dap.DAPSession - <R #1 initialize success {"supportsConfigurationDoneRequest":true,"supportsHitConditionalBreakpoints":false,"supportsConditionalBreakpoints":false,"supportsEvaluateForHovers":false,"supportsCompletionsRequest":false,"supportsRestartFrame":false,"supportsSetVariable":false,"supportsRestartRequest":false,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":false,"supportsLogPoints":false,"supportsExceptionInfoRequest":false,"supportsDataBreakpoints":false,"supportsClipboardContext":false,"supportsLoadedSourcesRequest":false}
16:18:45.565 [io-compute-3] INFO org.apache.daffodil.debugger.dap.DAPSession - <E initialized
16:18:45.570 [io-compute-2] INFO org.apache.daffodil.debugger.dap.DAPSession - R> #2 launch {"type":"dfdl","name":"Run File","request":"launch","program":"c:\\Users\\wassj\\Downloads\\test-dfdl-workspace\\jpeg.dfdl.xsd","data":"c:\\Users\\wassj\\Downloads\\test-dfdl-workspace\\works.jpg","debugServer":4711,"infosetOutput":{"type":"file","path":"jpeg-infoset.xml"},"__sessionId":"a434ed3a-bc18-4e9f-82eb-028a558e5594"}
16:18:45.574 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPSession - R> #3 configurationDone null
16:18:50.292 [io-compute-3] DEBUG org.apache.daffodil.debugger.dap.DAPodil - awaiting first stack frame
16:18:50.429 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-checkBreakpoints
16:18:50.431 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-control await
16:18:50.436 [io-compute-0] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - post-control await
16:18:50.439 [io-compute-2] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-checkBreakpoints
16:18:50.445 [io-compute-2] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-control await
16:18:50.453 [io-compute-1] WARN org.apache.daffodil.debugger.dap.Parse - deliverParseData: Errored(java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:/c:/Users/wassj/Downloads/test-dfdl-workspace/jpeg.dfdl.xsd)
java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:/c:/Users/wassj/Downloads/test-dfdl-workspace/jpeg.dfdl.xsd
        at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
        at java.base/java.nio.file.Path.of(Path.java:147)
        at java.base/java.nio.file.Paths.get(Paths.java:69)
        at com.microsoft.java.debug.core.protocol.Types$Source.<init>(Types.java:152)
        at org.apache.daffodil.debugger.dap.Parse$.$anonfun$createFrame$1(Parse.scala:348)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1196)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.runLoop(IOFiber.scala:336)
        at cats.effect.IOFiber.execR(IOFiber.scala:1126)
        at cats.effect.IOFiber.run(IOFiber.scala:125)
        at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:384)
16:18:50.475 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.Parse - infosetChanges (orig): Canceled
arosien commented 2 years ago

Cool, that stack helps. Thanks.

arosien commented 2 years ago

The underlying issue is that the DAP session expects sources referred to in stack frames to be paths, not URIs, but our code is supplying URIs because Daffodil uses URIs as their base representation for location of the schema.

jw3 commented 2 years ago

~Good news, the schema looked good, the data file failed~

Nevermind, I read the console wrong

17:23:54.210 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPodil -
******************************************************
A DAP server for debugging Daffodil schema processors.

Build info:
  version: 0.0.15-pre6
  daffodilVersion: 3.1.0
  scalaVersion: 2.12.13
  sbtVersion: 1.5.1

Built off commit e61d4d0 at 2021-08-31 21:11:06.717.
******************************************************
17:23:54.210 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPodil - launched with options listenPort: 4711, listenTimeout: 10 seconds
17:23:54.226 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPodil - waiting at tcp://0.0.0.0:4711
17:23:57.564 [io-compute-2] INFO org.apache.daffodil.debugger.dap.DAPodil - connected at tcp://0.0.0.0:4711
17:23:57.823 [io-compute-1] INFO org.apache.daffodil.debugger.dap.DAPSession - R> #1 initialize {"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"dfdl","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true}
17:23:57.968 [io-compute-3] INFO org.apache.daffodil.debugger.dap.DAPSession - <R #1 initialize success {"supportsConfigurationDoneRequest":true,"supportsHitConditionalBreakpoints":false,"supportsConditionalBreakpoints":false,"supportsEvaluateForHovers":false,"supportsCompletionsRequest":false,"supportsRestartFrame":false,"supportsSetVariable":false,"supportsRestartRequest":false,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":false,"supportsLogPoints":false,"supportsExceptionInfoRequest":false,"supportsDataBreakpoints":false,"supportsClipboardContext":false,"supportsLoadedSourcesRequest":false}
17:23:57.987 [io-compute-1] INFO org.apache.daffodil.debugger.dap.DAPSession - <E initialized
17:23:58.005 [io-compute-2] INFO org.apache.daffodil.debugger.dap.DAPSession - R> #2 launch {"type":"dfdl","name":"Run File","request":"launch","program":"c:\\Users\\wassj\\Downloads\\test-dfdl-workspace\\jpeg.dfdl.xsd","data":"c:\\Users\\wassj\\Downloads\\test-dfdl-workspace\\works.jpg","debugServer":4711,"infosetOutput":{"type":"file","path":"jpeg-infoset.xml"},"__sessionId":"2945861d-5c99-407d-b238-81e83a674da1"}
17:23:58.010 [io-compute-0] INFO org.apache.daffodil.debugger.dap.DAPSession - R> #3 configurationDone null
17:24:02.346 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.DAPodil - awaiting first stack frame
17:24:02.468 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-checkBreakpoints
17:24:02.468 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-control await
17:24:02.468 [io-compute-3] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - post-control await
17:24:02.483 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-checkBreakpoints
17:24:02.483 [io-compute-1] DEBUG org.apache.daffodil.debugger.dap.Parse.DaffodilDebugger - pre-control await
17:24:02.499 [io-compute-3] WARN org.apache.daffodil.debugger.dap.Parse - deliverParseData: Errored(java.nio.file.InvalidPathException: Illegal char <:> at index 2: /c:/Users/wassj/Downloads/test-dfdl-workspace/jpeg.dfdl.xsd)
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /c:/Users/wassj/Downloads/test-dfdl-workspace/jpeg.dfdl.xsd
        at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
        at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
        at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
        at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
        at java.base/java.nio.file.Path.of(Path.java:147)
        at java.base/java.nio.file.Paths.get(Paths.java:69)
        at com.microsoft.java.debug.core.protocol.Types$Source.<init>(Types.java:152)
        at org.apache.daffodil.debugger.dap.Parse$.$anonfun$createFrame$1(Parse.scala:348)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1196)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.mapK(IOFiber.scala:1205)
        at cats.effect.IOFiber.succeeded(IOFiber.scala:1012)
        at cats.effect.IOFiber.runLoop(IOFiber.scala:336)
        at cats.effect.IOFiber.execR(IOFiber.scala:1126)
        at cats.effect.IOFiber.run(IOFiber.scala:125)
        at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:306)
17:24:02.515 [io-compute-3] DEBUG org.apache.daffodil.debugger.dap.Parse - infosetChanges (orig): Canceled
jw3 commented 2 years ago

I can check back later for another version to test.

jw3 commented 2 years ago

Similar failure on the latest build. I will get a development environment set up on this windows machine and try to give some better feedback.

arosien commented 2 years ago

Similar failure on the latest build. I will get a development environment set up on this windows machine and try to give some better feedback.

Ugh. Sorry this is going on, and thanks for the help. I'll see how I can get access to a windows box somehow...

arosien commented 2 years ago

@jw3 can you post the exception you got? It should be slightly different, but maybe I screwed up.

jw3 commented 2 years ago

Looks like you got it, in the build I tested earlier.

  1. VS Code claimed to have loaded -pre7
  2. It did download -pre7 which I watched while it was being extracted in the xdg data dir
  3. The console reported that -pre6 was the one that was run

I didn't notice 3 until I went back to copy the full output for your ask.

Should test that upgrade process a little more. Maybe I missed a "reload required", could be.

Looks like you fixed this issue though. Ill test on linux to make sure its working there.

arosien commented 2 years ago

Looks like you got it, in the build I tested earlier.

  1. VS Code claimed to have loaded -pre7
  2. It did download -pre7 which I watched while it was being extracted in the xdg data dir
  3. The console reported that -pre6 was the one that was run

I didn't notice 3 until I went back to copy the full output for your ask.

Should test that upgrade process a little more. Maybe I missed a "reload required", could be.

Looks like you fixed this issue though. Ill test on linux to make sure its working there.

It's maybe not the best way to test the backend, but you can set useExistingServer to true in the launch.json and launch the backend directly from your dev env.

FYI I added some extra git versioning and build time metadata to the backend logging when it starts up, to help with knowing "what's really running".

jw3 commented 2 years ago

OK, so tested some uninstall and reinstall of different vsix versions and the behavior is pretty consistent. It is hard to believe I missed the easy to spot reload required boxes in multiple places, but that is the only explanation I have right now.

Tested on linux, also looks good.

jw3 commented 2 years ago

All good to merge this then?