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

SIGSEGV fault when running newton CGI interface #618

Open
janithpet opened this issue Aug 1, 2022 · 1 comment
Open

SIGSEGV fault when running newton CGI interface #618

janithpet opened this issue Aug 1, 2022 · 1 comment
Assignees
Labels

Comments

@janithpet
Copy link
Collaborator

janithpet commented Aug 1, 2022

Describe the bug
After fixing Issues #615, #616 and #617, and compiling, running the webtool generates the following text in red, on the top of the page:

⚠    Web interface to compiler halted the computation (WcgiAsync). Memory or CPU usage limit exceeded or other asynchronous error.

See screenshot below for how it is seen on the webpage.
image
This text is caused by the signal handler timeoutSignalHandler in src/newton/cgimain.c. By adding a write statement on line 116, to print the signal code that caused the error, we can see that it is a SIG-11 (SIGSEGV).

To Reproduce
Steps to reproduce the behavior; this assumes that Apache2 is setup, with cgi modules enabled on your machine:

  1. Clone repo using git clone --recursive [email protected]:phillipstanleymarbell/Noisy-lang-compiler.git
  2. Create config.local in root directory, and submodules/libflex. config.local looks like:
LIBFLEXPATH=<path-to-repo>/Noisy-lang-compiler/submodules/libflex
CONFIGPATH=<path-to-repo>/home/janith/Noisy-lang-compiler/submodules/libflex
OSTYPE=linux
MACHTYPE=x86_64
  1. run make in submodules/libflex.
  2. run mkdir icons in src/. This is a temporary fix for Issue-make installcgi in newton expects src/icons #616. See note below.
  3. run sudo cp NewtonBaseSignals.nt /usr/bin/cgi-bin/ from src/newton. This is a temporary fix for Issue-make installcgi in newton does not copy NewtonBaseSignals.nt to cgi-bin location #617.
  4. run make installcgi in src/newton.
  5. run
wget http://code.jquery.com/jquery-git.js /tmp/
sudo cp /tmp/jquery-git.js /var/www/html/tmp/

and

git clone https://github.com/ajaxorg/ace-builds.git /tmp/ace-builds
sudo cp -r /tmp/ace-builds/src-noconflict /var/www/html/tmp/
  1. On a browser, go to localhost/cgi-bin/newtoncgi-linux-EN/?c=.

Host OS (please complete the following information):

  • OS: Ubuntu 22.04 LTS (from lsb_release -a)
  • Clang: 11.1.0-6; Target: x86_64-pc-linux-gnu (from clang --version)
  • GCC: 11.2.0-19ubuntu1 (from gcc --version)

Your local changes (please complete the following information):

diff --git a/src/newton/Makefile b/src/newton/Makefile
index 292acf2bf..ef297265a 100644
--- a/src/newton/Makefile
+++ b/src/newton/Makefile
@@ -165,7 +165,6 @@ CGIOBJS             =\
                newton-irPass-LLVMIR-liveness-analysis.$(OBJECTEXTENSION)\
                newton-irPass-invariantSignalAnnotation.$(OBJECTEXTENSION)\
                newton-irPass-piGroupsSignalAnnotation.$(OBJECTEXTENSION)\
-               newton-irPass-estimatorSynthesisBackend/$(OBJECTEXTENSION)\
                newton-irPass-ipsaBackend.$(OBJECTEXTENSION)\
                newton-irPass-dimensionalMatrixAnnotation.$(OBJECTEXTENSION)\
                newton-irPass-dimensionalMatrixPiGroups.$(OBJECTEXTENSION)\
  • Output of git remote -v:
origin	[email protected]:phillipstanleymarbell/Noisy-lang-compiler.git (fetch)
origin	[email protected]:phillipstanleymarbell/Noisy-lang-compiler.git (push)

Additional Notes

  • the steps in To Reproduce set up the apache2 server on localhost.
  • Step 4. in To Reproduce will not copy any icons; thus,
@janithpet janithpet added the Bug label Aug 1, 2022
@janithpet janithpet self-assigned this Aug 1, 2022
@janithpet
Copy link
Collaborator Author

The following changes to cgimain.c seem to fix this issue.

--- a/src/newton/cgimain.c
+++ b/src/newton/cgimain.c
@@ -372,10 +372,10 @@ main(void)
        sigaction(SIGVTALRM, &sa, NULL);
 
 
-       newtonCgiState = init(kCommonModeDefault|kCommonModeCallStatistics/* | kCommonModeCallTracing */|kCommonModeCGI);
-       newtonCgiDimensionsState = init(kCommonModeDefault|kCommonModeCallStatistics/* | kCommonModeCallTracing */|kCommonModeCGI);
+       newtonCgiState = init(kCommonModeDefault/*|kCommonModeCallStatistics | kCommonModeCallTracing */|kCommonModeCGI);
+       newtonCgiDimensionsState = init(kCommonModeDefault/*|kCommonModeCallStatistics | kCommonModeCallTracing */|kCommonModeCGI);
        timestampsInit(newtonCgiState);
-
+       timestampsInit(newtonCgiDimensionsState);
 
        /*
         *      Extra \n, to send the blank line:

I will make a PR with these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant