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

temp test setup: try to migrate the LSP job #4921

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,67 @@ jobs:
if-no-files-found: error


java-cluster:
name: Experimental LSP job on JDK 8
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11' ]
fail-fast: false
steps:

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'zulu'

- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'

- name: Setup Xvfb
if: ${{ matrix.java != '20-ea' }} # see #4299
run: |
echo "DISPLAY=:99.0" >> $GITHUB_ENV
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &

- name: Checkout ${{ github.ref }} ( ${{ github.sha }} )
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: false

- name: Caching dependencies
uses: actions/cache@v3
with:
path: ~/.hgexternalcache
key: ${{ runner.os }}-${{ hashFiles('*/external/binaries-list', '*/*/external/binaries-list') }}
restore-keys: ${{ runner.os }}-

- name: Build Java Cluster
run: |
ant $OPTS -quiet -Dcluster.config=java -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false clean
ant $OPTS -quiet -Dcluster.config=java -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false build

- name: Reuse installed JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'zulu'

- name: java/java.lsp.server
run: ant $OPTS -Dcluster.config=java -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false -f java/java.lsp.server test
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if it matters for this test. But maybe inline the $OPTS here. Since I forgot a '-' where it is declared which causes yaml to add a newline at the end of the list.

  OPTS: >-
    -Dmetabuild.jsonurl=https://raw.githubusercontent.com/apache/netbeans-jenkins-lib/master/meta/netbeansrelease.json
    -Dtest-unit-sys-prop.ignore.random.failures=true

would be correct (note the - after >)

it is fixed in the original PR, forgot to add it here.


- name: Create Test Summary
uses: test-summary/action@v1
if: failure()
with:
paths: "./*/*/build/test/*/results/TEST-*.xml"


# secondary jobs
linux-commit-validation:
name: Commit Validation on Linux/JDK ${{ matrix.java }}
Expand Down
11 changes: 0 additions & 11 deletions .travis.yml → _.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,6 @@ matrix:
script:
- travis_wait nbbuild/travis/scripting.sh

# exile: for tests which don't behave. Job should be kept short to be easily restartable
- name: Test unreliable tests on Java 8
jdk: openjdk8
env:
- OPTS="-Dmetabuild.jsonurl=https://raw.githubusercontent.com/apache/netbeans-jenkins-lib/master/meta/netbeansrelease.json -quiet -Dcluster.config=java -Djavac.compilerargs=-nowarn -Dbuild.compiler.deprecation=false -Dtest-unit-sys-prop.ignore.random.failures=true"
before_script:
- nbbuild/travis/ant.sh $OPTS clean
- nbbuild/travis/ant.sh $OPTS build
script:
- travis_retry ant $OPTS -f java/java.lsp.server test

after_failure:
- nbbuild/travis/print-junit-report.sh
- sleep 3
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.net.Inet4Address;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
Expand All @@ -46,7 +47,10 @@
final class ConnectionSpec implements Closeable {
private final Boolean listen;
private final int port;
// @GuardedBy (this)
private final List<Closeable> close = new ArrayList<>();
// @GuardedBy (this)
private final List<Closeable> closed = new ArrayList<>();

private ConnectionSpec(Boolean listen, int port) {
this.listen = listen;
Expand Down Expand Up @@ -110,11 +114,15 @@ public <ServerType extends LspSession.ScheduledServer> void prepare(
@Override
public void run() {
while (true) {
Socket socket = null;
try {
Socket socket = server.accept();
socket = server.accept();
close.add(socket);
connectToSocket(socket, prefix, session, serverSetter, launcher);
} catch (IOException ex) {
if (isClosed(server)) {
break;
}
Exceptions.printStackTrace(ex);
}
}
Expand Down Expand Up @@ -144,19 +152,34 @@ public void run() {
serverSetter.accept(session, connectionObject);
connectionObject.getRunningFuture().get();
} catch (IOException | InterruptedException | ExecutionException ex) {
Exceptions.printStackTrace(ex);
if (!isClosed(socket)) {
Exceptions.printStackTrace(ex);
}
} finally {
serverSetter.accept(session, null);
}
}
};
connectedThread.start();
}

private boolean isClosed(Closeable c) {
synchronized (this) {
return closed.contains(c);
}
}

@Override
public void close() throws IOException {
for (Closeable c : close) {
c.close();
synchronized (this) {
for (Closeable c : close) {
try {
c.close();
closed.add(c);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import org.eclipse.lsp4j.jsonrpc.Launcher;
import org.eclipse.lsp4j.jsonrpc.MessageConsumer;
import org.eclipse.lsp4j.jsonrpc.MessageIssueException;
import org.eclipse.lsp4j.jsonrpc.RemoteEndpoint;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import org.eclipse.lsp4j.jsonrpc.messages.Message;
import org.eclipse.lsp4j.jsonrpc.messages.NotificationMessage;
Expand Down Expand Up @@ -119,6 +120,7 @@
import org.netbeans.spi.project.ActionProvider;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
import org.openide.util.NbBundle;
import org.openide.util.NbPreferences;
Expand Down Expand Up @@ -180,6 +182,10 @@ private static Launcher<NbCodeLanguageClient> createLauncher(LanguageServerImpl
}
});
})
.setExceptionHandler((t) -> {
LOG.log(Level.WARNING, "Error occurred during LSP message dispatch", t);
return RemoteEndpoint.DEFAULT_EXCEPTION_HANDLER.apply(t);
})
.create();
}

Expand Down Expand Up @@ -255,6 +261,9 @@ public void consume(Message msg) throws MessageIssueException, JsonRpcException
Lookups.executeWith(ll, () -> {
try {
delegate.consume(msg);
} catch (RuntimeException | Error e) {
LOG.log(Level.WARNING, "Error occurred during message dispatch", e);
throw e;
} finally {
// cancel while the OperationContext is still active.
if (ftoCancel != null) {
Expand Down
Loading