Skip to content

Concrete executor fails when generating tests for sockets #1590

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

Open
sofurihafe opened this issue Dec 26, 2022 · 0 comments · May be fixed by #1722
Open

Concrete executor fails when generating tests for sockets #1590

sofurihafe opened this issue Dec 26, 2022 · 0 comments · May be fixed by #1722
Assignees
Labels
comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug Issue is a bug

Comments

@sofurihafe
Copy link
Member

To Reproduce

  1. Generate a test for the following method with sandbox.policy file configured:
class SecurityCheck {
    public int connect(Socket socket) throws IOException {
        socket.connect(new InetSocketAddress("0.0.0.0", 22));
        return 0;
    }
}

Actual behavior

One of the generated tests looks like this:

public void testConnect_errors() {
    // Couldn't generate some tests. List of errors:
    // 
    // 2 occurrences of:
    // Default concrete execution failed

    // 2 occurrences of:
    /* RefType java.net.Inet6AddressImpl not loaded. If you tried to get the
    RefType of a library class, did you call loadNecessaryClasses()? Otherwise
    please check Soot's classpath. */

}
  1. Head to TEMP/UTBot/utbot-instrumentedprocess-errors folder and find the last log. This is where the stacktrace was found.

Visual proofs (screenshots, logs, images)

WARNING: package jdk.internal.jtrfs not in java.base
15:26:28.901 | INFO  | RdCoroutineScope          | RdCoroutineHost overridden 
15:26:28.953 | INFO  | ClientProtocolBuilder     | pid - 6292, port - 57422 
15:26:28.955 | INFO  | ClientProtocolBuilder     | isJvm8 - false, isJvm9Plus - true, isWindows - true 
WARNING: Illegal reflective access by com.esotericsoftware.kryo.kryo5.unsafe.UnsafeUtil (file:/C:/DevFolder/UTBotJava/utbot-intellij/build/idea-sandbox/plugins/utbot-intellij/lib/utbot-instrumentation-2022.12-SNAPSHOT.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Illegal reflective access by com.esotericsoftware.kryo.kryo5.unsafe.UnsafeUtil (file:/C:/DevFolder/UTBotJava/utbot-intellij/build/idea-sandbox/plugins/utbot-intellij/lib/utbot-instrumentation-2022.12-SNAPSHOT.jar) to method sun.nio.ch.DirectBuffer.cleaner()
15:26:29.326 | INFO  | InstrumentedProcess       | setup started 
15:26:29.357 | INFO  | InstrumentedProcess       | setup ended 
15:26:29.361 | INFO  | ClientProtocolBuilder     | signalled 
15:26:30.380 | INFO  | DynamicClassTransformer   | Transforming: SecurityCheck 
15:26:30.614 | ERROR | InstrumentedProcess       |  | org.utbot.framework.concrete.phases.ValueConstructionPhaseError: Error during phase of constructing values from models
	at org.utbot.framework.concrete.phases.ValueConstructionContext.wrapError(ValueConstructionContext.kt:29)
	at org.utbot.framework.concrete.phases.ValueConstructionContext.wrapError(ValueConstructionContext.kt:24)
	at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:243)
	at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:96)
	at org.utbot.instrumentation.process.InstrumentedProcessMainKt$setup$2.invoke(InstrumentedProcessMain.kt:128)
	at org.utbot.instrumentation.process.InstrumentedProcessMainKt$setup$2.invoke(InstrumentedProcessMain.kt:124)
	at org.utbot.rd.IdleWatchdog$wrapActiveCall$1$1.invoke(ClientProcessUtil.kt:96)
	at org.utbot.rd.IdleWatchdog.wrapActive(ClientProcessUtil.kt:83)
	at org.utbot.rd.IdleWatchdog$wrapActiveCall$1.invoke(ClientProcessUtil.kt:95)
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182)
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:173)
	at com.jetbrains.rd.framework.impl.RdCall.onWireReceived(RdTask.kt:360)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:12)
	at com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:151)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56)
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:12)
	at com.jetbrains.rd.util.threading.SingleThreadSchedulerBase$queue$1.run(SingleThreadScheduler.kt:41)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.utbot.framework.concrete.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:488)
	at org.utbot.framework.concrete.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:487)
	at org.utbot.instrumentation.process.SecurityKt$runSandbox$1$1.invoke(Security.kt:38)
	at org.utbot.instrumentation.process.SecurityKt$sandbox$1.invoke(Security.kt:61)
	at org.utbot.instrumentation.process.SecurityKt$sandbox$2.invoke(Security.kt:77)
	at org.utbot.instrumentation.process.SecurityKt$sandbox$3.invoke(Security.kt:82)
	at org.utbot.instrumentation.process.SecurityKt$sandbox$4.run(Security.kt:88)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:88)
	at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:82)
	at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:77)
	at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:61)
	at org.utbot.instrumentation.process.SecurityKt.runSandbox(Security.kt:38)
	at org.utbot.framework.concrete.constructors.MockValueConstructor.call(MockValueConstructor.kt:487)
	at org.utbot.framework.concrete.constructors.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:426)
	at org.utbot.framework.concrete.constructors.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:367)
	at org.utbot.framework.concrete.constructors.MockValueConstructor.construct(MockValueConstructor.kt:136)
	at org.utbot.framework.concrete.constructors.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:111)
	at org.utbot.framework.concrete.phases.ValueConstructionContext.constructParameters(ValueConstructionContext.kt:39)
	at org.utbot.framework.concrete.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:136)
	... 18 more
Caused by: java.lang.IllegalArgumentException: port out of range:-1
	at java.base/java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
	at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:224)
	at java.base/java.net.Socket.<init>(Socket.java:395)
	... 42 more

Environment

  • JDK11
  • Fresh main
  • sandbox.policy file
@sofurihafe sofurihafe added the ctg-bug Issue is a bug label Dec 26, 2022
@korifey korifey moved this to Todo in UTBot Java Dec 26, 2022
@sofurihafe sofurihafe added the comp-symbolic-engine Issue is related to the symbolic execution engine label Dec 26, 2022
@SBOne-Kenobi SBOne-Kenobi linked a pull request Jan 19, 2023 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-symbolic-engine Issue is related to the symbolic execution engine ctg-bug Issue is a bug
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants