Comments (17)
Here is the like to the project
https://github.com/BlackHart98/sqlpolyglot/blob/main/src/main/rascal/spark/prettyprint/Tests.rsc#L8
from rascal.
The trigger is this definition which results in an infinite recursion:
public str toString(ViewId viewId)="<toString(viewId)>";
I found this by setting
:set debugging true
in VScode and stepping through the code (with "step into"), until I got stuck myself in this place :-)The stackoverflow error thus genuine, so that's not the bug, but the report of this stackoverflow is bad. It should have given a stack trace like so:
... toString(ViewId viewId) ... toString(ViewId viewId) ... toString(ViewId viewId) ... toString(ViewId viewId) ... toString(ViewId viewId) ...
Such than easy diagnosis can be made. I'll look into fixing that in the Rascal interpreter. In the mean time this definition would be a good workaround:
public str toString(propRef(list[Identifier] ids))="<for (id <- ids) {><id> <}>"[..-1];
Yeah figured that out belatedly, but like you said the report is bad but is genuine
from rascal.
Thinking about the fix now. not so easy :-) I need to get some stack space to create the error, but I also need the information on the stack to create the error message.
from rascal.
@BlackHart98 I don't know. What do you mean by "resolves the project". Is that the code for starting a terminal or when you read a file with the
project:///
scheme? or something else? It's unrelated to this I think, but could also be interesting to look at in a different issue :-)Thanks for reporting this one anyway. The solution is underway but I need some advice from @DavyLandman to finalize it.
Maybe my choice of word was wrong, what I meant is the it takes time to load the rascal project after I save changes(on VSCode)
from rascal.
I think it would be nice to share your project, as quite some stuff is going wrong here.
from rascal.
from rascal.
Does it also happen if you call testCreateDB()
directly?
from rascal.
I reproduced the behavior. The stackoverflows happen when this test is called:
test bool testAlterV() {
loc file = |project://sqlpolyglot/src/main/rascal/spark/examples/alterv.ssql|;
return prettyCond(file);
}
if I remove this test, everything runs smoothly.
from rascal.
The trigger is this definition which results in an infinite recursion:
public str toString(ViewId viewId)="<toString(viewId)>";
I found this by setting :set debugging true
in VScode and stepping through the code (with "step into"), until I got stuck myself in this place :-)
The stackoverflow error thus genuine, so that's not the bug, but the report of this stackoverflow is bad. It should have given a stack trace like so:
... toString(ViewId viewId)
... toString(ViewId viewId)
... toString(ViewId viewId)
... toString(ViewId viewId)
... toString(ViewId viewId)
...
Such than easy diagnosis can be made. I'll look into fixing that in the Rascal interpreter. In the mean time this definition would be a good workaround:
public str toString(propRef(list[Identifier] ids))="<for (id <- ids) {><id> <}>"[..-1];
from rascal.
Looks like an interesting project @BlackHart98 !
from rascal.
Simple reproduction:
rascal>int f(int i) = f(i);
int (int): function(|prompt:///|(0,20,<1,0>,<1,20>))
rascal>f(2)
java.lang.StackOverflowErrorjava.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.StackOverflowError
java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
(internal error)
at $shell$(|main://$shell$|)
java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
Unexpected (uncaught) exception, closing the REPL:
java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModulesjava.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
java.io.IOException: Stream closed
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.lang.StackTraceElement$HashedModules
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"
from rascal.
The problem seems to be this code which catches the StackOverflowError just below the deepest stack frame, and then calls more code which needs stack space to print the error:
In Expression.CallOrTree.interpret()
:
catch (StackOverflowError e) {
e.printStackTrace();
throw RuntimeExceptionFactory.stackOverflow(this, eval.getStackTrace());
}
from rascal.
Looks like an interesting project @BlackHart98 !
I also noticed that Rascal resolves the project a lot slower, hat could be the issue?
from rascal.
@BlackHart98 I don't know. What do you mean by "resolves the project". Is that the code for starting a terminal or when you read a file with the project:///
scheme? or something else? It's unrelated to this I think, but could also be interesting to look at in a different issue :-)
Thanks for reporting this one anyway. The solution is underway but I need some advice from @DavyLandman to finalize it.
from rascal.
Ah yes. No that's a "feature" of the slow type-checker. The more modules you edit, the more it needs to type-check and the slower it becomes. We are working on a compiled version of that as we speak to make that faster.
from rascal.
If you keep the .tpl files in your target folder, the type-checker will reuse as much as possible. So that helps. I'd put the target folder in your .gitignore
and remove it from git with git rm -r target
. That way the time stamps of the .tpl files stay in order when you git pull
or git push
and you have less work for the typechecker usually.
from rascal.
Thanks, :-)
from rascal.
Related Issues (20)
- Wrong warning "unknown keyword argument" HOT 1
- `iprintln` with `lineLimit=-1` does not come back to the prompt. HOT 6
- Need to run on JRE 17 (link with classes compiled with JDK 17)
- unnecessary `isEmpty` check inside `isSameFile` HOT 3
- strange NPE in java-air HOT 3
- List assignable with negative index throws Java ArrayIndexOutOfBoundsException or Rascal IndexOutOfBounds HOT 1
- Writing ADT not overwritten default values HOT 1
- Low transparency failure to resolve libraries HOT 4
- Default pom.xml file for a Rascal project does not include META-INF folder in jar HOT 1
- Documentation building process HOT 2
- (off topic) Modern parser generator for Haskell HOT 4
- Get function for maps with default value HOT 3
- Negative numbers after ? seem to be ambiguous HOT 1
- parse error in Rascal module in terminal reported with internal stack trace
- Splicing concrete list after empty list-variable loses layout after the inserted spliced list
- "Except" does not work correctly with shared prefixes in nonterminals, leading to ambiguity HOT 14
- New `mvn` scheme to replace `lib` scheme. HOT 16
- Add basic support for renaming refactoring
- Java Compiler Exception in RascalMPL while parsing HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rascal.