go2sh / cmake-integration-vscode

CMake Server Interface for VSCode.
https://go2sh.github.io/cmake-integration-vscode/
Other
19 stars 11 forks source link

Failed to restart CMake: connect ECONNREFUSED /tmp/projectname-cmake.sock #1

Closed atar-axis closed 5 years ago

atar-axis commented 5 years ago

Hi there! Thank you for your Extension, looks really great at a first glance. Unfortunately I am not able to use it yet :disappointed:

When I try to clean the project, the following message appears: Failed to restart CMake: connect ECONNREFUSED /tmp/ff1_selfcheck-3044-cmake.sock

Furthermore hitting F7 does nothing.

Additional Context

flood@flood-r3 ~> cmake --version
cmake version 3.13.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

CMakeLists.txt

cmake_minimum_required( VERSION 3.12 )

# Define the compiler locations
set (CMAKE_C_COMPILER   gcc)
set (CMAKE_CXX_COMPILER g++)

# projectname
project (ff1_selfcheck)

# directories where to search for header files
include_directories(src)
include_directories(inc)

# cpp files to compile
set (srcs BrickChecker.cpp DeviceFileChecker.cpp ErrorDisplay_7seg.cpp ErrorDisplay.cpp ErrorDisplay_LEDButton.cpp main.cpp NetworkChecker.cpp)
list (TRANSFORM srcs PREPEND "src/") # cmake >= 3.12

# executable to create
add_executable (${PROJECT_NAME} ${srcs})

# link libraries
target_link_libraries(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/lib/${CMAKE_SYSTEM_PROCESSOR}/libbrick.a)
target_link_libraries(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/lib/${CMAKE_SYSTEM_PROCESSOR}/libaf3pihal.a)
target_link_libraries(${PROJECT_NAME} ${CMAKE_SOURCE_DIR}/lib/${CMAKE_SYSTEM_PROCESSOR}/libyaml-cpp.a)
target_link_libraries(${PROJECT_NAME} pthread)

add_definitions(-Wall -std=c++11 -g)

settings.json

{
        "files.associations": {
            "iostream": "cpp",
            "cstdint": "cpp",
            "ostream": "cpp",
            "vector": "cpp",
            "thread": "cpp",
            "cctype": "cpp",
            "clocale": "cpp",
            "cmath": "cpp",
            "cstdarg": "cpp",
            "cstddef": "cpp",
            "cstdio": "cpp",
            "cstdlib": "cpp",
            "cstring": "cpp",
            "ctime": "cpp",
            "cwchar": "cpp",
            "cwctype": "cpp",
            "array": "cpp",
            "atomic": "cpp",
            "*.tcc": "cpp",
            "chrono": "cpp",
            "list": "cpp",
            "unordered_map": "cpp",
            "exception": "cpp",
            "fstream": "cpp",
            "functional": "cpp",
            "initializer_list": "cpp",
            "iomanip": "cpp",
            "iosfwd": "cpp",
            "istream": "cpp",
            "limits": "cpp",
            "memory": "cpp",
            "numeric": "cpp",
            "optional": "cpp",
            "ratio": "cpp",
            "sstream": "cpp",
            "stdexcept": "cpp",
            "streambuf": "cpp",
            "string_view": "cpp",
            "system_error": "cpp",
            "type_traits": "cpp",
            "tuple": "cpp",
            "typeinfo": "cpp",
            "utility": "cpp",
            "algorithm": "cpp",
            "string": "cpp"
        },
        "C_Cpp.loggingLevel": "Debug",
        "C_Cpp.intelliSenseEngineFallback": "Enabled",
        "cmake.generator": "Unix Makefiles"
        }

Log (Extension Host)

[2019-01-13 17:07:01.576] [exthost] [info] extension host started
[2019-01-13 17:07:01.800] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"activationEvent":"*"}
[2019-01-13 17:07:01.800] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/debug-auto-launch/dist/extension
[2019-01-13 17:07:01.830] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"activationEvent":"*"}
[2019-01-13 17:07:01.830] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/emmet/dist/extension
[2019-01-13 17:07:01.918] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"activationEvent":"*"}
[2019-01-13 17:07:01.918] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/git/dist/main
[2019-01-13 17:07:02.276] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"activationEvent":"*"}
[2019-01-13 17:07:02.276] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/merge-conflict/dist/extension
[2019-01-13 17:07:02.296] [exthost] [info] ExtensionService#_doActivateExtension SanaAjani.taskrunnercode {"startup":true,"activationEvent":"*"}
[2019-01-13 17:07:02.296] [exthost] [info] ExtensionService#loadCommonJSModule /home/flood/.vscode-oss/extensions/sanaajani.taskrunnercode-0.3.0/out/extension
[2019-01-13 17:07:02.304] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing {"startup":false,"activationEvent":"onLanguage:jsonc"}
[2019-01-13 17:07:02.304] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/configuration-editing/dist/extension
[2019-01-13 17:07:02.331] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features {"startup":false,"activationEvent":"onLanguage:jsonc"}
[2019-01-13 17:07:02.331] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/json-language-features/client/dist/jsonMain
[2019-01-13 17:07:02.545] [exthost] [info] ExtensionService#_doActivateExtension vscode.typescript-language-features {"startup":false,"activationEvent":"onLanguage:jsonc"}
[2019-01-13 17:07:02.545] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/typescript-language-features/dist/extension
[2019-01-13 17:07:02.863] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.cpptools {"startup":true,"activationEvent":"workspaceContains:/.vscode/c_cpp_properties.json"}
[2019-01-13 17:07:02.863] [exthost] [info] ExtensionService#loadCommonJSModule /home/flood/.vscode-oss/extensions/ms-vscode.cpptools-0.20.1/out/src/main
[2019-01-13 17:07:04.398] [exthost] [info] ExtensionService#_doActivateExtension vscode.grunt {"startup":false,"activationEvent":"onCommand:workbench.action.tasks.runTask"}
[2019-01-13 17:07:04.398] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/grunt/dist/main
[2019-01-13 17:07:04.419] [exthost] [info] ExtensionService#_doActivateExtension vscode.gulp {"startup":false,"activationEvent":"onCommand:workbench.action.tasks.runTask"}
[2019-01-13 17:07:04.419] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/gulp/dist/main
[2019-01-13 17:07:04.481] [exthost] [info] ExtensionService#_doActivateExtension vscode.jake {"startup":false,"activationEvent":"onCommand:workbench.action.tasks.runTask"}
[2019-01-13 17:07:04.481] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/jake/dist/main
[2019-01-13 17:07:04.524] [exthost] [info] ExtensionService#_doActivateExtension vscode.npm {"startup":false,"activationEvent":"onCommand:workbench.action.tasks.runTask"}
[2019-01-13 17:07:04.524] [exthost] [info] ExtensionService#loadCommonJSModule /usr/lib/code/extensions/npm/dist/main
[2019-01-13 17:07:05.329] [exthost] [info] ExtensionService#_doActivateExtension go2sh.cmake-integration-vscode {"startup":true,"activationEvent":"workspaceContains:**/CMakeLists.txt"}
[2019-01-13 17:07:05.329] [exthost] [info] ExtensionService#loadCommonJSModule /home/flood/.vscode-oss/extensions/go2sh.cmake-integration-vscode-0.1.3/out/src/extension
[2019-01-13 17:07:05.651] [exthost] [info] eager extensions activated
flood@flood-r3 ~> ps -aux | grep cmake
flood     1470  7.1  4.4 1243072 174048 ?      Sl   16:24   3:35 /usr/lib/chromium/chromium --ppapi-flash-version=32.0.0.101 --ppapi-flash-path=/usr/lib/PepperFlash/libpepflashplayer.so https://github.com/go2sh/cmake-integration-vscode
flood     4438  0.1  0.3  54536 13652 ?        S    17:07   0:00 cmake -E server --pipe=/tmp/ff1_selfcheck-4314-cmake.sock --experimental
flood     5057  0.0  0.0   8188   880 pts/0    S+   17:14   0:00 grep --color=auto cmake
atar-axis commented 5 years ago

The line after workspaceManager -> restartClient -> yield client.start(); is not reached.

I think the problem must be somewhere here:

    createConnection() {
        let socket = new net.Socket();
        let connection = protocol.createProtocolConnection(socket, socket);
        connection.onMessage((msg) => this.onMessage(msg));
        connection.onSignal((data) => this.onSignal(data));
        connection.onProgress((progress) => this.onProgress(progress));
        this._hello = new Promise((resolve) => {
            connection.onHello((msg) => {
                this._state = ClientState.RUNNING;
                resolve(msg);
            });
        });
        let cmakePath = vscode.workspace.getConfiguration("cmake", this.uri).get("cmakePath", "cmake");
        let configEnv = vscode.workspace.getConfiguration("cmake", this.uri).get("configurationEnvironment", {});
        let processEnv = process.env;
        let env = Object.assign({}, processEnv, configEnv);

        this._process = child_process.execFile(cmakePath, ["-E", "server", "--pipe=" + this.pipeName, "--experimental"], { env: env });
        this._connection = connection;

        return new Promise((resolve, reject) => {
            let errorHandler = (err) => {
                this._state = ClientState.STOPPED;
                this._process = undefined;
                reject(err);
            };
            this._process.on("error", errorHandler);
            // Wait some time until cmake server is spawned, the server creates the pipe
            setTimeout(() => {
                socket.connect(this.pipeName);
                socket.on('error', errorHandler);
                socket.on('connect', () => {
                    // Remove promise handlers
                    socket.removeListener('error', errorHandler);
                    this._process.removeListener('error', errorHandler);
                    socket.on("close", () => {
                        this._state = ClientState.STOPPED;
                        if (this._process) {
                            this._process.kill();
                        }
                    });
                    this._process.on("exit", (code, signal) => {
                        this._state = ClientState.STOPPED;
                        this._process = undefined;
                    });
                    connection.listen();
                    this._state = ClientState.CONNECTED;
                    resolve();
                });
            }, 500);

        });
    }
atar-axis commented 5 years ago

this.pipe is btw /test-9099-cmake.sock

flood@flood-r3:[~]$ cat /tmp/test-9099-cmake.sock 
cat: /tmp/test-9099-cmake.sock: No such device or address
flood@flood-r3:[~]$ cmake -E server --pipe=/tmp/test-9099-cmake.sock --experimental 
CMake Error: Internal Error with /tmp/test-9099-cmake.sock: EADDRINUSE
go2sh commented 5 years ago

Hi, thanks for trying this extension. I know, that it is in a quiet early state, but I hoped to get some testers like you. :-) I think, I found the bug. I try to come up a fix tonight or tomorrow. I have some more fixes and features in the pipeline. So stay tuned. :-)

atar-axis commented 5 years ago

Perfect! Thank you for your quick response and your hard work, I am at your disposal :)

atar-axis commented 5 years ago

It seems like you are a bit busy right now, so if I can help you in any way - let me know ;)

go2sh commented 5 years ago

Hi there, I have been quite busy lately. Sometimes it's hard to find the right balance between work, family and spare time. :) I just updated the extension. Can you try, if this version fixes your problem?

atar-axis commented 5 years ago

Hey there, no problem :) thank you for your efforts! F7 works and I faced no crashes so far :+1: Thanks!

Unfortunately, I cannot switch between the projects now :grin:

peek 2019-01-22 15-38

go2sh commented 5 years ago

:see_no_evil: Missed that, fixed that with 0.2.1. Feel free to open more issues, when you find some more bugs. :-)