#JShell project for Tj-Bot!
1 messages ยท Page 2 of 1
i added a new GHA called pre-commit that does gradle build
it'll build + spotlessCheck + run tests
@sterile crest you forgot this
pushed
and did you change the properties + compose in the vps ?
You are giving me more tasks -_-
and that's why it's called pair programming 
i have to go for a little bit that's why
Wait a minute
how do I checkout on your branch ?
Since it's a fork
do I have to clone ?
yeah
my account isn't added as a maintainer that's why
so i have to use forks
and I don't wanna setup tj-wazei on intellij because multiple accounts start causing issues
the repo looks so nice though now 
You didn't fix it
Try to click on it
it will fail
@sterile crest
its pushed
Actually
im gonna remove the docker-compose step
since we added the compose to the repo
you have to change it
you have to change the step into move it to the folder
Yea, there are things I want to change, better like this
Why did you remove the java plugin for the wrapper ?
it's inherited from the parent gradle
subprojects {
apply plugin: 'java'
ah maybe
I don't remember what I put
but there should be a run task
used only for debugging
okay i removed that from the API because Spring gives you a run, it wasn't present in wrapper
but I can add it
sec
the comment isn't needed
no, in the build.gradle please
so someone who read it know why it is here
and why it should or shouldn't be used
what did you do so I can't just regular push ?
ur commits signed?
what are signed comits ?
do you know about GPG?
no
I can't even run the wrapper anymore
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.base/java.util.Scanner.nextLine(Scanner.java:1660)
at org.togetherjava.jshell.wrapper.JShellWrapper.run(JShellWrapper.java:22)
at org.togetherjava.jshell.Main.main(Main.java:9)
public static Config load() {
return new Config(loadIntEnv("evalTimeoutSeconds"), loadIntEnv("sysOutCharLimit"));
}
static int loadIntEnv(String envName) {
return Integer.parseInt(System.getenv(envName));
}
set your environment variables up
It's not a problem about the env variables
It's System.in which is closed
see the error
scanner.nextLine is failing
pushed a maybe fix
my tests are failing 
because of this crappy line-encoding issue
I fixed that in the past
by modifying gradle config
Seems like you broke it ๐
And no, I won't try to fix it again
Me not knowing gradle + trash issue = way too much time lost on it
fix it yourself
i didn't ask u to fix it
so at least it works
yay
but now, the tests to fix ๐
oh
it's not gradle
it was spotless i think
ah fuck
spotless
bahaah
or was it...
hmm
i mean they're easy fixes
pusheddd โค๏ธ
perfect checks pass
if you're happy with the PR hit approve
then merge and update VPS
@timber mirage i have added application.yaml and updated the docker-compose.yml
just double check it
maybe not
can u show me what u did
or it could be with verifyStartupEval
POST .../jshell/eval/test?startupScriptId=CUSTOM_DEFAULT
2+2
Note that it worked before
curl --request POST \
--url 'http://localhost:8080/jshell/eval/test?startupScriptId=CUSTOM_DEFAULT' \
--header 'Content-Type: text/plain' \
--header 'User-Agent: insomnia/2023.5.8' \
--data '2+2'
works for me
{
"snippetsResults": [
{
"status": "VALID",
"type": "ADDITION",
"id": 23,
"source": "2+2",
"result": "4"
}
],
"abortion": null,
"stdoutOverflow": false,
"stdout": ""
}
and the tests on GH are passing too?
i did gradle bootRun and then just made that request
tests are pssing
is this a new bug?
Ah I know
You deleted an else
and there were no tests to test it
So
Moving the files + doing modifications was a very bad idea
Wait you changed a lot of other code
I'm sorry but that's way to much to try to figure out
please roll back all those changes
You introduced at least two bugs here
And within the 60 files, I don't know how many are they
So refactoring code will be in another PR
So roll back the changes for the switches for now
What I want you to fix isn't this bug, but rather remove all the refactoring you did and move it in another pr, it's extremely hard to review this when there are so many modifications, that between the code format and the rename of files, it's impossible to tell what was changed into what
so keep this pr as project improvment (docker, gradle, delete useless files) and formatting code
the rest, move it to another pr
ah, boys doing stunt development in discord chat 
what a beautiful thing to wake up to
will do that later, I'm busy right now
no rush
backend is currently chain crashing, for anyone interested
looks like this (but suuper fast moving
)
?!
ohj
ohh
the current PR will fix it
I didn't realize but as part of using Java 21 the Spring Plugin needed updating
release it the same way you would on tj-bot
in github UI, on master, you will likely have button "master is behind, click to create PR"
but PR is just there for documentation purposes, and for visibility
i can't click the create pr button
noob
how
alright done
@timber mirage good for prod?
I guess ?
Well
Nobody expect us really tested it but ๐คท
we're competent enough
There is a `
30 minutes after last eval, so check their logs and see when was the last eval
show more of the logs please
JSHELL IS PUBLIC!?
this explains why there was random requests coming in - random bots on the internet do this
Snippets
Snippet 31, VALID
// Import necessary classes
import java.net.*;```
### Snippet 32, VALID
```java
import java.io.*;```
### Snippet 33, VALID
```java
// Define the URL
URL url = new URL("http://togetherjava.org");```
jshell> `http://togetherjava.org`
### Snippet 34, VALID
```java
// Open the connection
HttpURLConnection con = (HttpURLConnection) url.openConnection();```
jshell> `sun.net.www.protocol.http.HttpURLConnection:http://togetherjava.org`
### Snippet 35, VALID
```java
// Set the request method
con.setRequestMethod("GET");```
### Snippet 36, VALID
```java
// Get the response code
int responseCode = con.getResponseCode();```
## [WARNING] The code couldn't end properly...
Problematic source code:
```java
// Get the response code
int responseCode = con.getResponseCode();```
Cause:
Uncaught exception:
java.net.UnknownHostException:togetherjava.org
Remaining code:
```java
System.out.println("Response Code: " + responseCode);
// Read the response
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
// Close the connections
in.close();
con.disconnect();
// Print the content
System.out.println(content.toString());```
## System out
[Nothing]
Snippets
Snippet 31, VALID
// Import necessary classes
import java.net.*;```
### Snippet 32, VALID
```java
import java.io.*;```
### Snippet 33, VALID
```java
// Define the URL
URL url = new URL("https://togetherjava.org");```
jshell> `https://togetherjava.org`
### Snippet 34, VALID
```java
// Open the connection
HttpURLConnection con = (HttpURLConnection) url.openConnection();```
jshell> `sun.net.www.protocol.https.DelegateHttpsURLConnection:https://togetherjava.org`
### Snippet 37, VALID
```java
// Set the request method
con.setRequestMethod("GET");```
### Snippet 36, VALID
```java
// Get the response code
int responseCode = con.getResponseCode();```
## [WARNING] The code couldn't end properly...
Problematic source code:
```java
// Get the response code
int responseCode = con.getResponseCode();```
Cause:
Uncaught exception:
java.net.UnknownHostException:togetherjava.org
Remaining code:
```java
System.out.println("Response Code: " + responseCode);
// Read the response
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
// Close the connections
in.close();
con.disconnect();
// Print the content
System.out.println(content.toString());```
## System out
[Nothing]
Snippets
[WARNING] The code couldn't end properly...
Problematic source code:
// Import necessary classes import java.net.http.*; import java.net.URI; import java.io.IOException; import java.util.concurrent.CompletableFuture; // Create an HttpClient HttpClient client = HttpClient.newHttpClient(); // Create an HttpRequest HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://togetherjava.org")) .build(); // Send the request asynchronously and get a CompletableFuture CompletableFuture<HttpResponse<String>> response = client.sendAsync(request, HttpResponse.BodyHandlers.ofString()); // Print the response body when it's available response.thenAccept(res -> { System.out.println("Response Code: " + res.statusCode()); System.out.println("Response Body: " + res.body()); }).join();```
Cause:
The code doesn't compile, there are syntax errors in this code.
## System out
[Nothing]
Snippets
Snippet 38, VALID
// Import necessary classes
import java.net.http.*;```
### Snippet 39, VALID
```java
import java.net.URI;```
### Snippet 40, VALID
```java
import java.io.IOException;```
### Snippet 41, VALID
```java
import java.util.concurrent.CompletableFuture;```
### Snippet 42, VALID
```java
// Create an HttpClient
HttpClient client = HttpClient.newHttpClient();```
jshell> `jdk.internal.net.http.HttpClientImpl@1f57539(1)`
### Snippet 43, VALID
```java
// Create an HttpRequest
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("http://togetherjava.org"))
.build();```
jshell> `http://togetherjava.org GET`
### Snippet 44, VALID
```java
// Send the request asynchronously and get a CompletableFuture
CompletableFuture<HttpResponse<String>> response = client.sendAsync(request, HttpResponse.BodyHandlers.ofString());```
jshell> `jdk.internal.net.http.common.MinimalFuture@59906517[Not completed] (id=7)`
### Snippet 45, VALID
```java
// Print the response body when it's available
response.thenAccept(res -> {
System.out.println("Response Code: " + res.statusCode());
System.out.println("Response Body: " + res.body());
}).join();```
## [WARNING] The code couldn't end properly...
Problematic source code:
```java
// Print the response body when it's available
response.thenAccept(res -> {
System.out.println("Response Code: " + res.statusCode());
System.out.println("Response Body: " + res.body());
}).join();```
Cause:
Uncaught exception:
java.util.concurrent.CompletionException:java.net.ConnectException
## System out
[Nothing]
@compact holly sorry for ping, maybe you can help
i think it's because it's using "Driver": "bridge" which my wisdom from Virtual Box tells me is that it uses the host network card
There's also "Internal": false,
somone (possibly maliciously) edited docker compose 
that's the only way this can happen
and now our backend service is exposed to the whole internet 
that's why it's best to wait for me to double check everything
there are no issues with network
only way this can happen is if someone edited the docker compose
messed with the ports
ports:
- 8080:8080
or done some weird nginx redirection to make this public
this?
yes, that 
open anyway
kwl
you probably don''t even need ports exposed
that fixed the issue
so just remove ports alltogheter
i think tj-bot needs it
try it
you mean it's not publicly exposed?
yeah
since that's a huge security risk 
yeah, it's not
the network it is connected to is
wait, let me go over things
idk if the IaC pulls this docker-compose
i don't think the docker-compose is pulled from the repo - so this PR might not be needed
fuck
will u do it?
so tj-bot needs bridge to access external api's right?
but jshell and tj-bot both need to be on the same networrk to communicate
can you add another network interface, maybe?
Pong!
Snippets
Snippet 23, VALID
2+3```
jshell> `5`
## System out
[Nothing]
good
oh u fixed ๐
well, that's the thing, you had it exposed publicly on the internet, with no checks in place
you don't know how bad it is 
yeah it's bad especially for many reason, one example you'd understand is having setup spring with no security in mind
among opening up jshell to the entire planet
any zero day vulnerability can screw us
but just to flex, feel free to enjoy ur exploits to your hearts content: https://vz7fbzekqnhroe6jh6zkx3akra0smlov.lambda-url.eu-west-2.on.aws/
omg marko i have a feature idea
can we make a /slash command that can makes API requests? - we can use my lambda
what kind of requests?
any request
like curl, but in discord?
to make it extra fun, we can censor the auth header and x-api-key header in our response so people are safe to do stuff like that
because technically we have lambda
in my discord project, i can live call the API
backend has that purpose
you throw some shit, it will manage containers and stuff
and give you back the result
but not sure if we want to continue this route
i don't know how comfortable you are using ur vps with egress
because we might as well open up jshell to the internet
then we wouldn't need a dedicated curl command
why
too many bad things you can do with it
what does wazei bot do?
nothing - but all the commands that don't fit tjbot
jshell with internet and disk, cURL command
or any linux capabilities
have a command that mimics a linux terminal
that can be integrated into tjbot
i was gonna use it as an excuse to try our new discord framework in the wild
it doesn't need to be called "wazei bot"
you can use whatver name u want
and keep the bot token
i just wanna eventually implement linux into discord
- but i don't think i can with aws lambda - would have to be a vps
but it couldn't be yours because it's already running too many things
would you be willing to entertain my idea using a new bot written in our framework?
hopefully when we decide to implement linux in doscrd, we also have enough money for 4 cores lol
I don't see the purpose
whole point of tjbot was to eliminate other bots
have one bot that does everything
less confusing for newcomers
i just wanna cURL so i can show example requests in my project thread when people are discussing fixes/the api
well having a linux session would mean superior answers in #1051826284008853505
"hey how do i do this"
"run these commands, look i'll show you"
/linux apt update
etc etc
sure, but we can do that with tjbot
yeah we can
with some limited capabilities
u down?
exactly
you would have to limit tho
should i post in #server-suggestions
we don't want people to donwload illegal material on our network
basically restrict access to only the safe stuff
But why was it exposed ?
we just need baby containers - 500mb disk, small cpu
that have a lifespan of 5 mins
because someone edited docker compose
and exposed one of the few ports that are not blocked by firewall
on the host
ah 8080 ? that's not me then 
pretty sure I put 54321
port 54321 was also exposed to the internet
see
wait it was ?
check the url
did someone mess with firewall config?
waitwait
no
why is port 54321 exposed ?
that's the issue with having too many people vps access
nope
u can revoke me if u want - i don't mind
because someone exposed that port
i rather have access only when i'm needed
but that's not the only issue, it should've been blocked by the firewall
i reckon the firewall was already misconfigured from the beginning lol
it is, unless you can escape docker
anyway
which shouldn't be possible
doesn't matter who or how did it
just be extremely careful, and know exactly what you are doing
when you edit live production machine
or wait for me to double check the whole flow
can't you add something which alerts when something as important as the firewall is changed ?
marko trying to blame us when it was probably his mistake 
๐
it's always my mistake
๐
by default, because this is my responsibility
We mean, it was you who were playing with the network trying to connect tjbot to backend
u can see all the commands that were run anyway - so if you're really curious just check the history
because I gave you all root access
๐
doesn't matter who did it
but someone exposed 8080 on the host
and network was misconfigured
jshell was on the wrong network
it wasn't prepared for production properly
and 54321
tbh
i reckon all ports are not being blocked
u can test that by just opening any port
they should be
can you check the firewall and see which ports are blocked ?
because it's not normal that 54321 wasn't blocked
it's a very random port, that only you and me used (and I used it because you told me to use it)
so there is no reason for 54321 to not be blocked
yes, all prots should be blocked
unless all ports are not blocked by default
all ports are blocked by default, expect few
it doesn't need exposed ports
they are talking internally
instead of 8080:8080 ?
nothing, no ports exposed
if you do 8080: stuff, you expose your service to the whole world and bots
that's catastrophic failure
but can you do :8080 ?
you expose ports to enable port forwarding
like on a router
if you are on internal network
you don't need port forwarding
i posted the suggestion :3
ah, I'll check that
that 54321:8080 port thing I sent you was just for testing
becuase it's likely you are already using 8080 when locally testing backend
it's just random thing, not meant for prod
firewall should be tested too
yeah, I think it's blocking everyhting
you can try 54321 again
it is, because it has exposed docker socket
so that container can spawn arbitary containers
what ?
backend is not properly contained
you can spawn container with exposed 8080, mining bitcoin, or do whatever
you can spawn container that is not really a container
so you can basically do anything
yeah, it's possible
how ?
I mean
you said that it is possible
so prove it
so I can see that and fix it
there is no fix, it's designed that way
backend is not properly isolated, so if exploited, it's bad
wdym
You can't access docker from jshell
so show me how it is possible to exploit it
Because for me, what you are saying seem impossible
we have a level 10 CVE almost every day 
april has been crazy
RCE is not only possible, but probable on any tech
especially in tech we made
mean, this while 2024 year, you seem to forgot all the CVE that appeared in both mac, linux or whatever
yes
then show it please, do it
i'm not doing security analysis for free 
what I'm saying is, if someone finds a way to explot it, it's bad
command injection or
except you are talking about our own VPS security
so if I understand properly
what you are saying is that
it isn't that there is a vulnerability
but rather that a vulnerability
but in this case
what you are talking is just air
...
it's simple
backend is not on the same isolation like jshell containers
not even remotely
it's almost as ran on the host
from the security perspective
yes, but if backend has vulns, it's bad
same for tj bot
not the same, because that app is containerized better
if you find a way to bypass chatgpt command ratelimits, byebye money
true, it would have serious consequeces
what does better mean ?
but not RCE on vps
doesn't matter
it should be in back on our minds that backend is not the same as jshell contaienrs, or tjbot containers
docker socket is exposed
so it can spawn containers
if you can spawn containers, you can spawn containers with no isolation basically
you can spawn cryptominers, or expose some malicious service publicly on the internet
steal our production database
access filesystem
delete the host OS
can you spawn container with less isolation than yourself ?
i'm talking about the #server-suggestions
yeah, you can spawn any container
it's like on host running docker containers, no difference
so whole vps can be compromised
so design idea was, keep backend as safe and sanitized as possible
@compact holly since you are the one who thinks the most about security
Tell me if this issue could help, and if there is anything you want to improve in it https://github.com/Together-Java/TJ-Bot/issues/1119
@timber mirage is the startup script not same for everyone?
import java.nio.charset.*;
import java.nio.file.*;
import java.text.*;
import java.time.*;
import java.time.chrono.*;
import java.time.format.*;
import java.time.temporal.*;
import java.time.zone.*;
import java.nio.charset.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import java.util.random.*;
import java.math.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.prefs.*;
import java.util.regex.*;
import java.util.stream.*;
void print(Object o) { System.out.print(o); }
void println(Object o) { System.out.println(o); }
void printf(String s, Object... args) { System.out.printf(s, args); }
Iterable<Integer> range(int startInclusive, int endExclusive) {
return IntStream.range(startInclusive, endExclusive)::iterator;
}
then y do u need the id to fetch that
In the future, we might have several of them
currently
the only option are either use this one or use none
but in the future, we might add other startup script
@compact holly @sterile crest can one of you review my PR please ?
i don't want to put my name on these tests sorry, they're really badly done and I want to stay away from them
i can help introduce new tests but the current set doesn't adhere to even entry level guidelines - so maybe somebody else could give you the tick
I just want to validate this pr because it's for adding a test on something that wasn't tested before
so I really need this test in case a problem happens
Improving that will be another PR about redoing it
@compact holly ?
you can just mention me on github ^^
we have done a lot of discussions on discord, that will be lost forever
design decisions, why we done some things certain way..
everything project related should happen on github, ideally
the default config works
just follow what the readme says
u need to update that
what's the problem ?
Have you managed to make it work ?
U don't need to manually compile wrapper noe
It was running I haven't tested it yet
wdym
@timber mirage
POST /eval?startupScriptId=0 HTTP/1.1
Content-Length: 27
Content-Type: application/json
Host: localhost:8080
User-Agent: HTTPie
System.out.println("good");
the error is 404
ohh its /jshell/eval
it's /jshell/eval
yea
what should i be?
this parameter is optional
so if you don't have any starup script
don't use it
and if you want one
use CUSTOM_DEFAULT
@timber mirage
what's the error in insomnia ?
{
"timestamp": "2024-05-22T00:57:30.879+00:00",
"status": 409,
"error": "Conflict",
"message": "Session may have been forcibly destroyed.",
"path": "/jshell/eval"
}
is the docker not starting or smth?
Do you get any other logs ?
no
no containers :c
im trying again but same thing
the container is not starting ig
windows?
If you have such error, then you should have other logs, are you sure you have nothing ?
linux
that is all yes
you indeed have another error
wer
InternalServerErrorException: Status 500
how did you build the image ?
i did not i just did ./gradlew clean bootRun
show the images
@timber mirage how do u build the image on the server tho?
u sould push the image on docker hub no?
automatically built
it works the same as tjbot
the watchtower detects when something is pushed on master branch
and run jib
i'll at least copy paste what u have in readme
the readme of jshellapi isn't up to date anymore
@timber mirage y not just autowrie the field?
better avoid black magic when i can
tho a better approach would probably be to use the constrcuctor
the code is getting cancerous ๐
@timber mirage i see ur spotless sucks, may i interest u in a new spotless config
@timber mirage whats the difference between eval and single-eval
If it's transformming into that, it's not worth it
huh? so u dont want openapi spec?
Not me, it was wazei ๐ฆ
the session is way shorter
I want it, but it's not worth it to do it manually if it is such a mess
i mean u gotta write the text manually tho
it generates schema and stuff automatically
@io.swagger.v3.oas.annotations.parameters.RequestBody(
content = {
@Content(
mediaType = "text/plain",
examples = {
@ExampleObject(
name = "Hello world example",
value =
"System.out.println(\"Hello,"
+ " World!\");"),
@ExampleObject(
name =
"Hello world example with startup"
+ " script",
value = "println(\"Hello, World!\");")
})
})
this is kinda excessive we can skip this if u want
also half the problem is bad spotless
Pull-request
I have read the contributing guidelines.
I have read the code guidelines.
I have created a relating issue.
Changes
Existing code
New feature
Closes Issue: NaN
Description
Rep...
sakamura, it's been so long I seen you on here 
one of the OG devs
๐
Happy to see JShell ? ๐
What are you doing here ? Want to contribute ?
in fact, I think sakamura created our together java github org
his billing email is still there 
if we get into some legal trouble, they gonna knock on sakamura's doors
๐
I've been peeking in and out mostly
It sucks that I have so little time for OS projects
@timber mirage so r u just gonna ghost my prs
Please wait a bit
I worked a lot for jshell recently
Now I am trying to work less on it
@timber mirage can u at least merge my spotless pr so i can continnue on other stuff
basically writing openapi docs which u'll later reject
looks better now
master?
Tomorrow
we can either server this using github pages or just the hosted url (i dont think thats a good idea)
its accessible at <base>/swagger-ui/index.html (changeable)
and the docs should be at /v3/api-docs and /v3/api-docs.yaml (also changeable)
@vivid cliff I don't like this
marko wanted same config
same for this
-_-
run what?
the backend
also did you change anything else ?
outside of the formatting
no
no
spotless one? yes
alright
review the openapi spec
mhh
I really don't like the size of the doc in the controller
is there any way to fix it ?
maybe extract an interface ?
so the interface only has method signatures + annotations
- annotations?
is that possible
maybe
try to find a way
adding auto openapi generation is not worth this code polution imo
added this as a review
I won't accept it unless a solution is found
:c
Added a PR with bug fixes
@compact holly any solution https://github.com/Together-Java/JShellPlaygroundBackend/issues/30 ?
I also really need to get this merged, because jshell is currently broken right now ๐ฆ
solution to what?
that testing the api requires docker?
yes
can the github pipeline handles this ?
yeah, it's just a ubuntu machine/vm
it should
if it has docker installed
of course, that would be a functional test
@compact holly you haven't replied to https://github.com/Together-Java/TJ-Bot/issues/1119
@compact holly โ ?
Also can you review and merge the PR to master please ?
history is slightly fucked
someone merged the github PR, and instructions clearly say do not merge the PR
so now histories are not the same 
master is not the clone of develop
but it's fixable, slight divergence
@compact holly can you do it please https://github.com/Together-Java/JShellPlaygroundBackend/pull/32
@compact holly is there a way so jshellbackend logs are reported on a specific channel on discord, like tjbot ?
because it's starting to become annoying, to not know when a problem happens and to have to log in the vps in order to see what is going on
โ @compact holly
there is, by creating a webhook
and configuring github
to push relevant info
here is a guide I guess
you should have permissions for everything
if not, let me know
@vivid cliff any news for swagger?
Umm no i wasn't working on it
I'll try sm stuff after I get back home
@sterile crest if you wanted to look at it, it seems that jshell backend is broken again
did you grab logs?
no
I mean
Can't you get the logs yourself ?
i don't know, do you pipe the logs to a file or anything?
i can't remember much but if you want, we can do an investigation into it later today?
get back to work
alright
Btw any advancement about openapi?
wazei doing exploitative child labour in 2024 
no
i'm available now if you want to investigate?
any updates, does it work properly now?
no
yes, doesn't help
we added more logs and we hope that it helps
or it's not a code problem, but environment problem where shit is crashing and burning down?
okay
no idea
but we can't reproduce it
and it happens randomly
sometime it happens after 3 days, sometime after 3 weeks
and there is nothing abnormal caught by logging?
yeah, seemes like logging should be improved a lot
and maybe put it on debug level
so we get a detailed preview for the next week
I had an idea but before we blindly implement my theory we added additional logging
ala doesn't want verbose logging because it can get repetitive 
but me.. i wanted entry/exit logs, all params, null checks etc logged even if the logging is duplicated
easier to trace the logs to code but you know, personal preferences get in the way
but the 2 theories we have are:
- the scheduler is crashing
it doesn't have to be duplicated
- the sdk call is hanging - our scheduler is single threaded so a hanging sdk call pauses the entire thing
just detailed enough on debug/trace level
duplicated as in:
it's justvery weird that shit is crashing, and we have no clue where, why, when..
void doSomethng(obj) {
if(obj == null) logNull();
anotherThing(obj);
}
void anotherThing(obj) {
if(obj == null) logNull();
}```
even tho in anotherThing it won't ever be null due to the call chain - i like it to do it ๐
The thing is that wazei tried to stress test it without result
wait
did we enable debug logging ?
go check
I don't think so
it could also be a timing with the API - for example, it could be using a persistent connection and after no usage, the connection dies
how do we enable it already ?
could be anything
it doesn't use a db
it shouldn't be anything :"D
we aboslutely must have at least an idea where the problem might lie
It's either the docker api blocking endlessly for no reason or the scheduler crashing or something we have no idea
I don't think so
not with our shitty logs ๐
shitty at a personal standard
well yeah, that's what i'm trying to say
this is not the first time
logs should point us to the exact call that went wrong, and why it went wrong
if I can log the way I wanna log, the logs will show the entire flow of code - statement/block level
or at least to a method/class
or some smallest unit of the system
in the worst case
that's a bit aggro, but yeah, that's what trace level should do
yeah it's exactly what trace is for
and not just the flow, but the values
^^
We currently have enough logs to at least know what the cause is
once it will happen
since everything probably goes trough the main flow, there is one way to spawn the container, there is one api endopont, there is one..
it's never too late to switch to my AWS solution which is still online and hasn't gone down since I made it :3
faulty shit has to travel at least a bit trough the main flow
so it will be caught
which is like < 200 LoC
consider it as a free public jshell api :3
backed by "Wazei Ltd"
i technically have employees too, so it's maintained :3
and we offer customer support :3
it's unrestricted jshell โค๏ธ
we could do something like that, just together :p
Yeah depending on the usages it could end up being free
You could start building it in local
check the repository
Mention me if you have any question
@bright lark so did you plan to try it today or ?
i was busy in something
now im checking
this is it right ? https://github.com/Together-Java/JShellPlaygroundBackend
nevermind
Yep
wdym?
for the docker image ?
or something else ?
ah
i got it building
as explained in the readme, there are several ways to run it
?
im trying to use IDE helpers
on top there is Main
it's for the rest api app
the guide says "Go in Run โ Run... โ Edit Configurations โ create a configuration"
what kind of config ?
Java
But, you are trying to run the wrapper itself, why ?
im reading the readme
Yes
Yes
gotit
running the wrapper is only needed if you want to work on the wrapper
also
you might notice that there are two ways to run the api
in local, on inside docker
(same as tj bot)
do i have to use docker ?
hmm so i need both
ye ok
i don't know why i dnt have same interface as the one in readme

which part of the readme are you following ?
So you are trying to run the wrapper itself at the end ?
right
and see in action how it works
ok
So ?
ah u're right
ye
it fails
then enter System.out.println("hello");
ah I forgot what the order was
you can find examples of execution in the tests
eval
1
System.out.println("Hello world!")""", """
OK
0
OK
1
VALID
ADDITION
1
System.out.println("Hello world!")
false
Hello world!\\n
like this one
eval
1
2
OK
1
VALID
ADDITION
1
2
2false
let me try again
Task :JShellWrapper:run
OK
0Exception in thread "main" java.lang.RuntimeException: No such command ""
this is ugly
it should continue running, this exception should be catched
you didn't enter a blank line
seems like it
i did
???
right
and got the exception
i didn't write 0
๐ค
ah
yes
it's the length of the startupt script my bad
you enter a blank line
then eval
then 1
what does that mean?
you will understand that later
eval
1
3
OK
1
VALID
ADDITION
1
3
3false
this seems wrong though
anyway do i run spring boot locally too ?
cuz i don't like using docker image if it's not hosted
blank line
eval
1
System.out.println("hello");
Enter this
read the readme
wdym
i mean in a docker repo
wdym
no they don't need to be pushed to a repo
and they won't be if you run it in local, otherwise what's the point of running it in local
You need at least docker for the wrapper even if you run the api without docker
as explained in the readme
the api spawns containers where each user can run code
Snippets
Snippet 23, VALID
2+2```
jshell> `4`
## System out
[Nothing]
A container was spawned just to run this code
if you try to use this command
it will spawn a container for you
ah
so by design, it needs to spawn containers for each user
it would be helpful if there is a diagram
like ?
i mean to show architecture and flow
how the whole system works
i get what u mean now
but for somebody else, it would be not ez to get tht alone
alright
let me try it out
im gonna add it
The problem
Is that I don't want openapi annotations to take too much place on the controller
And I advise you to talk with Taz since he already started @bright lark
ok, im gonna keep it in local
just to try
just merge it bro
Look at this, there are twice as many annotations than code -_-
@bright lark
we can avoid those

