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

importing net.openssl on linux causes tcp_conn.accept to fail #21257

Open
hholst80 opened this issue Apr 11, 2024 · 0 comments
Open

importing net.openssl on linux causes tcp_conn.accept to fail #21257

hholst80 opened this issue Apr 11, 2024 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@hholst80
Copy link
Contributor

hholst80 commented Apr 11, 2024

Describe the bug

Note that this is only for net.openssl it works just fine with net.mbedtls.

The following application starts just fine if there is no application already listening on port 8001:

import net
import time
// import net.openssl

fn main() {
	println('Hello World!')
	mut listener := net.listen_tcp(.ip, "127.0.0.1:8001", net.ListenOptions{}) or {
		eprintln(err)
		time.sleep(1*time.second)
		exit(1)
	}
	// fn listen_tcp(family AddrFamily, saddr string, options ListenOptions) !&TcpListener
	for {
		conn := listener.accept()!
	}
}

however, if net.openssl is included it fails:

src/main.v:19:3: warning: unused variable: `conn`
   17 |     // fn listen_tcp(family AddrFamily, saddr string, options ListenOptions) !&TcpListener
   18 |     for {
   19 |         conn := listener.accept()!
      |         ~~~~
   20 |         // eprintln('New conection from ${conn.peer_addr()!}')
   21 |         // mut buf_reader := io.new_buffered_reader(reader: conn)
Hello World!
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:19495: at time__Duration_microseconds: RUNTIME ERROR: division by zero
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:29224: by net__select
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:29272: by net__select_deadline
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:29302: by net__wait_for_common
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:29322: by net__wait_for_read
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:29936: by net__TcpListener_wait_for_accept
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:29867: by net__TcpListener_accept_only
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:29842: by net__TcpListener_accept
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:35458: by main__main
/tmp/v_0/k8s-proxy.01HV7E9ZHMA21RBM2YBRGK9V7Q.tmp.c:35856: by main

Reproduction Steps

Create main.v in a new directory and start v watch run .

Expected Behavior

The application behavior should not change, and the application should not crash.

Current Behavior

It crashes on the listen_tcp call.

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.5 27cd1b1

Environment details (OS name and version, etc.)

V full version: V 0.4.5 27cd1b1
OS: linux, "Artix Linux"
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz

getwd: /home/root/k8s-proxy
vexe: /home/root/Apps/v/v
vexe mtime: 2024-04-11 20:21:56

vroot: OK, value: /home/root/Apps/v
VMODULES: OK, value: /home/root/.vmodules
VTMP: OK, value: /tmp/v_0

Git version: git version 2.44.0
Git vroot status: weekly.2024.14-63-g27cd1b10
.git/config present: true

CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 40e5cbb5
@hholst80 hholst80 added the Bug This tag is applied to issues which reports bugs. label Apr 11, 2024
@hholst80 hholst80 changed the title importing net.openssl on linux causes listen_tcp to fail importing net.openssl on linux causes tcp_conn.accept to fail Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

1 participant