You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by nickva <gi...@git.apache.org> on 2015/10/08 21:24:15 UTC

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

GitHub user nickva opened a pull request:

    https://github.com/apache/couchdb-couch/pull/117

    Handle view server crashing during test compile of view functions.

    Due to how libmozjs185 library is compiled on Ubuntu 12.04, given
    invalid JS code, it will not return with expected error result:
    
     ["error","compilation_error",...]
    
    but will crash. Otherwise library seems functional --  it passes
    all other mrview tests.
    
    Handle this crash in try_compile() function as a compilation
    failure. Error message contains the exit status of the view process
    to help debugging.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloudant/couchdb-couch handle-view-server-crash-on-ubuntu1204

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-couch/pull/117.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #117
    
----
commit 1b09af3326d69786ee2054ff63f9ba295d9f29b4
Author: Nick Vatamaniuc <va...@gmail.com>
Date:   2015-10-08T19:21:59Z

    Handle view server crashing during test compile of view functions.
    
    Due to how libmozjs185 library is compiled on Ubuntu 12.04, given
    invalid JS code, it will not return with expected error result:
    
     ["error","compilation_error",...]
    
    but will crash. Otherwise library seems functional --  it passes
    all other mrview tests.
    
    Handle this crash in try_compile() function as a compilation
    failure. Error message contains the exit status of the view process
    to help debugging.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/couchdb-couch/pull/117


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/117#issuecomment-146696439
  
    +1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/117#discussion_r41581691
  
    --- Diff: src/couch_query_servers.erl ---
    @@ -38,10 +38,15 @@ try_compile(Proc, FunctionType, FunctionName, FunctionSource) ->
         try
             proc_prompt(Proc, [<<"add_fun">>, FunctionSource]),
             ok
    -    catch {compilation_error, E} ->
    -        Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    -        Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    -        throw({compilation_error, Msg})
    +    catch
    +        {compilation_error, E} ->
    +            Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    +            Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    +            throw({compilation_error, Msg});
    +        {os_process_error, {exit_status,PErr}} ->
    --- End diff --
    
    and a better name? `ExitCode`, say.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/117#discussion_r41581663
  
    --- Diff: src/couch_query_servers.erl ---
    @@ -38,10 +38,15 @@ try_compile(Proc, FunctionType, FunctionName, FunctionSource) ->
         try
             proc_prompt(Proc, [<<"add_fun">>, FunctionSource]),
             ok
    -    catch {compilation_error, E} ->
    -        Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    -        Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    -        throw({compilation_error, Msg})
    +    catch
    +        {compilation_error, E} ->
    +            Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    +            Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    +            throw({compilation_error, Msg});
    +        {os_process_error, {exit_status,PErr}} ->
    --- End diff --
    
    space before PErr


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/117#discussion_r41582312
  
    --- Diff: src/couch_query_servers.erl ---
    @@ -38,10 +38,15 @@ try_compile(Proc, FunctionType, FunctionName, FunctionSource) ->
         try
             proc_prompt(Proc, [<<"add_fun">>, FunctionSource]),
             ok
    -    catch {compilation_error, E} ->
    -        Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    -        Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    -        throw({compilation_error, Msg})
    +    catch
    +        {compilation_error, E} ->
    +            Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    +            Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    +            throw({compilation_error, Msg});
    +        {os_process_error, {exit_status,PErr}} ->
    --- End diff --
    
    Oh, right. Agree here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by nickva <gi...@git.apache.org>.
Github user nickva commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/117#issuecomment-146737524
  
    @rnewson  @kxepal  -- renamed PErr to ExitStatus. Fixed spacing issue.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/117#discussion_r41565281
  
    --- Diff: src/couch_query_servers.erl ---
    @@ -38,10 +38,15 @@ try_compile(Proc, FunctionType, FunctionName, FunctionSource) ->
         try
             proc_prompt(Proc, [<<"add_fun">>, FunctionSource]),
             ok
    -    catch {compilation_error, E} ->
    -        Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    -        Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    -        throw({compilation_error, Msg})
    +    catch
    +        {compilation_error, E} ->
    +            Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    +            Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    +            throw({compilation_error, Msg});
    +        {os_process_error, {exit_status,PErr}} ->
    +            Fmt = "Compilation of the ~s function in the '~s' view failed with exit status: ~p",
    --- End diff --
    
    Here could be not only compilation issue. File not found, permission deny etc. You would like to expand PErr here for these cases.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Handle view server crashing during tes...

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/117#discussion_r41574253
  
    --- Diff: src/couch_query_servers.erl ---
    @@ -38,10 +38,15 @@ try_compile(Proc, FunctionType, FunctionName, FunctionSource) ->
         try
             proc_prompt(Proc, [<<"add_fun">>, FunctionSource]),
             ok
    -    catch {compilation_error, E} ->
    -        Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    -        Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    -        throw({compilation_error, Msg})
    +    catch
    +        {compilation_error, E} ->
    +            Fmt = "Compilation of the ~s function in the '~s' view failed: ~s",
    +            Msg = io_lib:format(Fmt, [FunctionType, FunctionName, E]),
    +            throw({compilation_error, Msg});
    +        {os_process_error, {exit_status,PErr}} ->
    +            Fmt = "Compilation of the ~s function in the '~s' view failed with exit status: ~p",
    --- End diff --
    
    nvm, this is `try_compile` function and all what it want to do is to compile a function. It's fine for me to have such message here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---