Skip to content

remote debugging - remote server is different OS from local server #948

Closed

Description

@weinand

From Loreton on March 2, 2018 15:47

  • VSCode Version: 1.17.2
  • OS Version: Windows 7

Steps to Reproduce:

  1. prepare code on linux using netiface module
  2. run debug from windows to remote linux
    When the local module (windows), in my case "netifaces", has different characteristics from remote module (linux) we get error reading the network interface caracteristics. Why? It should run remote code and not local code.
    Regards

Does this issue occur when all extensions are disabled?: Yes/No

Copied from original issue: microsoft/vscode#44932

Activity

  1. weinand commented on Mar 5, 2018

    @weinand
    Author

    From VSCode Bot (@vscodebot)[bot] on March 2, 2018 15:47

    (Experimental duplicate detection)
    Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

  2. weinand commented on Mar 5, 2018

    @weinand
    Author

    From Isidor Nikolic (@isidorn) on March 2, 2018 15:56

    Sounds like a potential duplicate of the wsl issues, forwarding to Andre Weinand (@weinand)

  3. weinand commented on Mar 5, 2018

    @weinand
    Author

    Loreton How does your launch config look like?

  4. weinand commented on Mar 5, 2018

    @weinand
    Author

    From Loreton on March 5, 2018 11:4

    my main.py code

    # ####################################
    # #### R E M O T E  - Linux OS #############
    # ####################################
    
    # ******** D E B U G *********************************
    import ptvsd
    ptvsd.enable_attach("my_secret", address=('localhost', 3000))
    ptvsd.wait_for_attach() # only in the remote node
    # ******** D E B U G *********************************
    
    
    import sys; sys.dont_write_bytecode = True
    import  Source as Prj
    
    myLibName = ['LnPyLib', 'DDNS_v2018-02-27.zip'] 
    LnLib     = Prj.SPE.LibPath(myLibName, fDEBUG=False)
    
    
    
    # ####################################
    # #### L O C A L    Windows OS ############
    # ####################################
    
    # ******** D E B U G *********************************
    import ptvsd
    ptvsd.enable_attach("my_secret", address=('localhost', 3000))
    # ptvsd.wait_for_attach() # only in the remote node
    # ******** D E B U G *********************************
    
    
    import sys; sys.dont_write_bytecode = True
    import  Source as Prj
    
    myLibName = ['LnPyLib', 'DDNS_v2018-02-27.zip']   **_<=== BreakPoint_**
    LnLib     = Prj.SPE.LibPath(myLibName, fDEBUG=False)

    Problem

    When I start the debugger I can STEP just the first two line and the I get an error regarding a missing feature of netifaces module (AF_PACKET).

      File "y:\GIT-REPO\Python3\DDNS\__main__.py", line 79, in <module>
        Prj.Main(gv.args.firstPosParameter)
      File "y:\GIT-REPO\Python3\DDNS\Source\Main\DDNS_Main.py", line 83, in Main
        interfaces     = Ln.getInterfaces(dictType=Ln.Dict)
      File "y:\GIT-REPO\Python3\DDNS\LnPyLib\Net\InterfacesCl.py", line 418, in getInterfaces
        ifc = Interfaces(ifcName)
      File "y:\GIT-REPO\Python3\DDNS\LnPyLib\Net\InterfacesCl.py", line 116, in __init__
        self.arpPing(self._gatewayIpAddress)
      File "y:\GIT-REPO\Python3\DDNS\LnPyLib\Net\InterfacesCl.py", line 319, in arpPing
        macAddressHex   =  bytes.fromhex(self._MAC_address.replace(':',''))
    AttributeError: 'NoneType' object has no attribute 'replace'
    

    But this feature is missed just in windows module and not in linux one.
    In any case:

    1. it doesn't stop in the breakpoint line.
    2. the TCP connection to remote machine NOT starts

    launch extract configuration

       "configurations": [
            {
                "name": "Python",
                "type": "python",
                "request": "launch",
                "stopOnEntry": true,
                "pythonPath": "${config:python.pythonPath}",
                "program": "${file}",
                "cwd": "${workspaceRoot}",
                "env": {},
                "envFile": "${workspaceRoot}/.env",
                "debugOptions": [
                    // "WaitOnAbnormalExit",
                    // "WaitOnNormalExit",
                    "RedirectOutput"
                ],
                "args": [
                    "update",
                    "--profile",
                    "LnPi23"
                ]
            },
        ....
        i have the following tunnel ssh -L 3001:destMaschine:3000 
            {
                "name": "Attach (Remote Debug)",
                "type": "python",
                "request": "attach",
                "localRoot": "${workspaceRoot}",
                "remoteRoot": "/home/pi/GIT-REPO/Python3/DDNS",
                "port": 3001,    
                "secret": "my_secret",
                "host": "localhost"
            }
        ]

    Kind Regards

  5. DonJayamanne commented on Mar 5, 2018

    @DonJayamanne

    lorento
    Please could you change the remote python file being debugged as follows:

    my main.py code

    import ptvsd
    ptvsd.enable_attach("my_secret", address=('localhost', 3000))
    ptvsd.wait_for_attach()
    
    
    print("attached")
    a = input()
    print("something entered")    # **_<=== BreakPoint_**
    print("End")                  # **_<=== BreakPoint_**
    • Run the above file on the remote linux computer in a terminal window
    • Ensure the above file is also available on the local widows computer
    • Go into your local windows computer
    • Add a break point to the line print("something entered") and the line after as well
    • Select Attach (Remote Debug) and run that.
      Note: None of the Python code gets executed locally on your windows machine.
  6. Loreton commented on Mar 6, 2018

    @Loreton

    Hi Don,
    reading your last update, when you said:

    "Select Attach (Remote Debug) and run that."

    I realized I had omitted something important. I didn't select the configuration type to be used for debugging. I left the default. Selecting the right configuration it works fine and very fast.
    I am very sorry to have bothered You for my mistake.
    Thanks for Your support and best compliments for this product that I'm starting to discover.
    It's OK for me. Problem is solved.
    Regards
    Loreto

  7. added and removed
    info-neededIssue requires more information from poster
    bugIssue identified by VS Code Team member as probable bug
    on Mar 6, 2018
  8. locked as resolved and limited conversation to collaborators on Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions