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

error in process sentinel: dap--buffers-w-breakpoints: Wrong type argument: markerp, nil #796

Open
vibrys opened this issue Jul 5, 2024 · 9 comments

Comments

@vibrys
Copy link

vibrys commented Jul 5, 2024

after M-x dap-debug is called on launch.json file below, I get following error:

error in process sentinel: dap--buffers-w-breakpoints: Wrong type argument: markerp, nil
error in process sentinel: Wrong type argument: markerp, nil
error in process filter: dap--buffers-w-breakpoints: Wrong type argument: markerp, nil
error in process filter: Wrong type argument: markerp, nil

launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "sample.py performance",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/bin/sample.py",
            "args": [
                "-p", "performance", "-i", "Mul_0", "-m", "entry.xml", "-w", "entry.bin", "-f", "outsset", "-d", "./", "-o", "/tmp", "--subset_size=1000000", "--log-level", "ERROR"
            ],
            "stopAtEntry": false,
            "cwd": "${env:HOME}/scripts/plugin/",
            "environment": [],
            "externalConsole": false,
        },
    ]
}

then, here's the stacktrace with M-x toggle-debug-on-error:

Debugger entered--Lisp error: (wrong-type-argument markerp nil)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_58>(((:point 11697)))
  dap--buffers-w-breakpoints()
  dap--refresh-breakpoints()
  dap--mark-session-as-terminated(#s(dap--debug-session :name "sample.py performance" :last-id 8 :proc #<process sample.py performance> :response-handlers #<hash-table eql 0/65 0x15643bb28055> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *sample.py performance out*> :thread-id nil :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x15643c050d09> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x15643c050fdf> :thread-stack-frames #<hash-table eql 0/65 0x15643c0512bb> :launch-args (:name "sample.py performance" :type "python" :request "launch" :stopAtEntry :json-false :cwd "/home/user/scripts/plugin/" :environment [] :externalConsole :json-false :environment-variables nil :program "/home/user/.virtualenvs/v4525/lib/python3.8/..." :args ["-p" "performance" "-i" "Mul_0" "-m" "entry.xml" "-w" "entry.bin" "-f" "outsset" "-d" "./" "-o" "/tmp" "--subset_size=1000000" "--log-level" "ERROR"] :dap-server-path ("/home/user/.virtualenvs/v4525/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd405da63f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd404a663f>) :current-capabilities #<hash-table equal 20/65 0x15643c0515b9> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x15643c05188f> :output-displayed t))
  #f(compiled-function (process exit-str) #<bytecode -0x1857d8c9325df07e>)(#<process sample.py performance> "killed\n")
  delete-process(#<process sample.py performance>)
  dap--mark-session-as-terminated(#s(dap--debug-session :name "sample.py performance" :last-id 8 :proc #<process sample.py performance> :response-handlers #<hash-table eql 0/65 0x15643bb28055> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *sample.py performance out*> :thread-id nil :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x15643c050d09> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x15643c050fdf> :thread-stack-frames #<hash-table eql 0/65 0x15643c0512bb> :launch-args (:name "sample.py performance" :type "python" :request "launch" :stopAtEntry :json-false :cwd "/home/user/scripts/plugin/" :environment [] :externalConsole :json-false :environment-variables nil :program "/home/user/.virtualenvs/v4525/lib/python3.8/..." :args ["-p" "performance" "-i" "Mul_0" "-m" "entry.xml" "-w" "entry.bin" "-f" "outsset" "-d" "./" "-o" "/tmp" "--subset_size=1000000" "--log-level" "ERROR"] :dap-server-path ("/home/user/.virtualenvs/v4525/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd405da63f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd404a663f>) :current-capabilities #<hash-table equal 20/65 0x15643c0515b9> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x15643c05188f> :output-displayed t))
  dap--on-event(#s(dap--debug-session :name "sample.py performance" :last-id 8 :proc #<process sample.py performance> :response-handlers #<hash-table eql 0/65 0x15643bb28055> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *sample.py performance out*> :thread-id nil :workspace nil :threads nil :thread-states #<hash-table eql 1/65 0x15643c050d09> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x15643c050fdf> :thread-stack-frames #<hash-table eql 0/65 0x15643c0512bb> :launch-args (:name "sample.py performance" :type "python" :request "launch" :stopAtEntry :json-false :cwd "/home/user/scripts/plugin/" :environment [] :externalConsole :json-false :environment-variables nil :program "/home/user/.virtualenvs/v4525/lib/python3.8/..." :args ["-p" "performance" "-i" "Mul_0" "-m" "entry.xml" "-w" "entry.bin" "-f" "outsset" "-d" "./" "-o" "/tmp" "--subset_size=1000000" "--log-level" "ERROR"] :dap-server-path ("/home/user/.virtualenvs/v4525/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd405da63f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae292bd404a663f>) :current-capabilities #<hash-table equal 20/65 0x15643c0515b9> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x15643c05188f> :output-displayed t) #<hash-table equal 4/65 0x15643c12e7f5>)
  #f(compiled-function (m) #<bytecode 0x1639bf1112e79c43>)("{\"seq\": 22, \"type\": \"event\", \"event\": \"exited\", \"b...")
  mapc(#f(compiled-function (m) #<bytecode 0x1639bf1112e79c43>) ("{\"seq\": 22, \"type\": \"event\", \"event\": \"exited\", \"b..." "{\"seq\": 23, \"type\": \"event\", \"event\": \"terminated\"..." "{\"seq\": 24, \"type\": \"event\", \"event\": \"debugpySock..."))
  #f(compiled-function (_ msg) #<bytecode 0x11af92a94cd1f1be>)(#<process sample.py performance> "Content-Length: 72\15\n\15\n{\"seq\": 22, \"type\": \"event\",...")

versions are:

elpa/29.4/develop/dap-mode-20240611.1356
elpa/29.4/develop/lsp-mode-20240701.633

please help

kind regards,
Matt

@hariseldon78
Copy link

it happens even without a launch.json, chosing instead a template like this:

(dap-register-debug-template
  "LLDB::Run task"
  (list :type "lldb-vscode"
        :cwd "."
        :request "launch"
        :program "./task"
        :name "LLDB::Run"))

@hariseldon78
Copy link

at first inspection it seems related to this commit: ed360fd . I'll try rolling back dap-mode version before it and see if it works.

@hariseldon78
Copy link

Yes, rolling back to the previous commit actually solve the problem. @sfavazza and @sfavazza-duagon do you guys have any insight on what could be the issue? or how could i help you debug the problem?

@sfavazza
Copy link
Contributor

sfavazza commented Aug 8, 2024

I am not sure what it could be, I cannot reproduce it. I am sure @vibrys tried the latest package version. I checked it myself and I did not observed changes in the code affecting my contribution. Judging from the code the most probable cause of error I can think of is a change in the object returned by dap--get-breakpoints which might lead to a nil value.

I suggest you step-debug through it and see when exactly the markerp function is provided with a nil value.

@hariseldon78
Copy link

hariseldon78 commented Aug 10, 2024

So, I am not sure about what triggered this, but after restoring the old package version (20240611.1356) and running an "Update packages" (i'm running the spacemacs distribution) everything seems to work, it only gives me that error if i don't set a breakpoint in the source code (understandable). Maybe I could just add a clarifying message, if I'm able to debug it better i'll post a little PR.

@hariseldon78
Copy link

hariseldon78 commented Aug 11, 2024

if I'm able to debug it better i'll post a little PR.

Sorry, it seems that debugging the debugger is a bit too far from my skill set. Still a better error message would probably be a good idea.

@ryukinix
Copy link

ryukinix commented Dec 1, 2024

I've been experiencing this using dap-mode with Scala too.

Edit: actually using any language.

@sergeyklay
Copy link

I've been experiencing this using python-mode and the following debug template:

(dap-register-debug-template
 "My App :: Console entrypoint"
  (list :type "python"
        :request "launch"
        :name "My App :: Console entrypoint"
        :program "${workspaceFolder}/myapp/__main__.py"
        :cwd "${workspaceFolder}"
        :args '("-o" "abc" "${workspaceFolder}/output")
        :env '(("KEY" . "VAL"))))

I am debugging a console application and have set 3 breakpoints. During the debugging process, an exception occurs in the application before the first breakpoint is reached, and the debugger steps at the exception. If I proceed further, it crashes with the error message mentioned earlier by the author of this ticket. At the moment of halting at the exception, the function dap--get-breakpoints returns:

#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data
  ("/home/serghei/work/myapp/myapp/repo.py" ((:point 5921) (:point 5849))
   "/home/serghei/work/myapp/tests/conftest.py" ((:point 3903))))

Full BT:

Debugger entered--Lisp error: (wrong-type-argument markerp nil)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_58>(((:point 3903)))
  dap--buffers-w-breakpoints()
  dap--refresh-breakpoints()
  dap--mark-session-as-terminated(#s(dap--debug-session :name "My App :: Console entrypoint<4>" :last-id 12 :proc #<process My App :: Console entrypoint<4>> :response-handlers #<hash-table eql 0/65 0x1597bf130a95> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *My App :: Console entrypoint<4> out*> :thread-id nil :workspace nil :threads (#<hash-table equal 2/65 0x1597bf53f689>) :thread-states #<hash-table eql 0/65 0x1597bf668ecd> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x1597c017bd03> :thread-stack-frames #<hash-table eql 0/65 0x1597c0267001> :launch-args (:type "python" :request "launch" :name "My App :: Console entrypoint<4>" :cwd "/home/serghei/work/myapp" :env (("KEY" . "VAL")) :program "/home/serghei/work/myapp/myapp/__main__.py" :args ("-o" "abc" "/home/serghei/work/myapp/output") :dap-server-path ("/home/serghei/work/myapp/.venv/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae29027f088263f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae29027f0b8e63f>) :current-capabilities #<hash-table equal 20/65 0x1597c026722f> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x1597c026724f> :output-displayed t))
  #f(compiled-function (process exit-str) #<bytecode -0xbee45a2bd8043f7>)(#<process My App :: Console entrypoint<4>> "killed\n")
  delete-process(#<process My App :: Console entrypoint<4>>)
  dap--mark-session-as-terminated(#s(dap--debug-session :name "My App :: Console entrypoint<4>" :last-id 12 :proc #<process My App :: Console entrypoint<4>> :response-handlers #<hash-table eql 0/65 0x1597bf130a95> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *My App :: Console entrypoint<4> out*> :thread-id nil :workspace nil :threads (#<hash-table equal 2/65 0x1597bf53f689>) :thread-states #<hash-table eql 0/65 0x1597bf668ecd> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x1597c017bd03> :thread-stack-frames #<hash-table eql 0/65 0x1597c0267001> :launch-args (:type "python" :request "launch" :name "My App :: Console entrypoint<4>" :cwd "/home/serghei/work/myapp" :env (("KEY" . "VAL")) :program "/home/serghei/work/myapp/myapp/__main__.py" :args ("-o" "abc" "/home/serghei/work/myapp/output") :dap-server-path ("/home/serghei/work/myapp/.venv/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae29027f088263f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae29027f0b8e63f>) :current-capabilities #<hash-table equal 20/65 0x1597c026722f> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x1597c026724f> :output-displayed t))
  dap--on-event(#s(dap--debug-session :name "My App :: Console entrypoint<4>" :last-id 12 :proc #<process My App :: Console entrypoint<4>> :response-handlers #<hash-table eql 0/65 0x1597bf130a95> :parser #s(dap--parser :waiting-for-response nil :response-result nil :headers nil :body nil :reading-body nil :body-length nil :body-received nil :leftovers "") :output-buffer #<buffer *My App :: Console entrypoint<4> out*> :thread-id nil :workspace nil :threads (#<hash-table equal 2/65 0x1597bf53f689>) :thread-states #<hash-table eql 0/65 0x1597bf668ecd> :active-frame-id nil :active-frame nil :cursor-marker nil :state terminated :breakpoints #<hash-table equal 0/65 0x1597c017bd03> :thread-stack-frames #<hash-table eql 0/65 0x1597c0267001> :launch-args (:type "python" :request "launch" :name "My App :: Console entrypoint<4>" :cwd "/home/serghei/work/myapp" :env (("KEY" . "VAL")) :program "/home/serghei/work/myapp/myapp/__main__.py" :args ("-o" "abc" "/home/serghei/work/myapp/output") :dap-server-path ("/home/serghei/work/myapp/.venv/bin/python" "-m" "debugpy.adapter")) :local-to-remote-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae29027f088263f>) :remote-to-local-path-fn #f(compiled-function (&rest args2) #<bytecode -0xae29027f0b8e63f>) :current-capabilities #<hash-table equal 20/65 0x1597c026722f> :error-message nil :loaded-sources nil :program-proc nil :metadata #<hash-table eql 0/65 0x1597c026724f> :output-displayed t) #<hash-table equal 4/65 0x1597c1287057>)
  #f(compiled-function (m) #<bytecode 0x17d559690df183a3>)("{\"seq\": 177, \"type\": \"event\", \"event\": \"exited\", \"...")
  mapc(#f(compiled-function (m) #<bytecode 0x17d559690df183a3>) ("{\"seq\": 177, \"type\": \"event\", \"event\": \"exited\", \"..."))
  #f(compiled-function (_ msg) #<bytecode -0xfb5db174b8e9c22>)(#<process My App :: Console entrypoint<4>> "Content-Length: 73\15\n\15\n{\"seq\": 177, \"type\": \"event\"...")

@sfavazza
Copy link
Contributor

@sergeyklay if you can consistently reproduce this issue, I suggest you get to the function dap-mode.el:dap--buffers-w-breakpoints and with the pointer inside it instrument it with edebug (if using spacemacs you can type , d f ). Hence step-debug through it.

I don't know the details of the implementation of DAP, the change I introduced in ed360fd was meant to speed up the breakpoint refreshing as I always have a lot of open files and only few breakpoints (see first contribution). So this was the only way I found to scan through the buffers with breakpoints rather than all files. Maybe there is a better way to scan through the buffers with breakpoints.

@yyoncho do you have any suggestion regarding this issue?

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

5 participants