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

Bug while practicing copying the concurrency examples #21905

Closed
jorgeluismireles opened this issue Jul 21, 2024 · 0 comments · Fixed by #21906
Closed

Bug while practicing copying the concurrency examples #21905

jorgeluismireles opened this issue Jul 21, 2024 · 0 comments · Fixed by #21906
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: Checker Bugs/feature requests, that are related to the type checker.

Comments

@jorgeluismireles
Copy link

jorgeluismireles commented Jul 21, 2024

V doctor:

V full version: V 0.4.6 2cde320.0ebf184
OS: linux, Ubuntu 20.04.6 LTS
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz

getwd: /home/jorge/go/src/gitlab.com/jmireles/v/concurrency
vexe: /home/jorge/v/v
vexe mtime: 2024-07-21 17:44:09

vroot: OK, value: /home/jorge/v
VMODULES: OK, value: /home/jorge/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.25.1
Git vroot status: weekly.2024.29-19-g0ebf184c
.git/config present: true

CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
thirdparty/tcc status: thirdparty-linux-amd64 a0799a5b

What did you do?
v -g -o vdbg cmd/v && vdbg http.v

import net.http
import sync
import time

fn vlang_time(mut wg sync.WaitGroup) !string {
	start := time.ticks()
	data := http.get('https://vlang.io/utc_now')!
	finish := time.ticks()
	println('Finish getting time ${finish - start} ms')
	println(data.body)
	wg.done()
	return data.body
}

fn remote_ip(mut wg sync.WaitGroup) !string {
	start := time.ticks()
	data := http.get('https://api.ipify.org')!
	finish := time.ticks()
	println('Finish getting ip ${finish - start} ms')
	println(data.body)
	wg.done()
	return data.body
}

fn main() {
	mut wg := sync.new_waitgroup()
	wg.add(2)
	spawn vlang_time(mut wg)
	spawn vlang_ip(mut wg)
	wg.wait()
}

What did you expect to see?

The same that github.com/vlang/v/blob/master/examples/concurrency/concurrency_http.v

What did you see instead?

================ V panic ================
   module: v.ast
 function: default_table_panic_handler()
  message: final_sym: invalid type (typ=ast.Type(0x0 = 0) idx=0). Compiler bug. This should never happen. Please report the bug using `v bug file.v`.
     file: /home/jorge/v/vlib/v/ast/table.v:86
   v hash: 0ebf184
=========================================
/tmp/v_1000/../../../../../../home/jorge/v/vlib/builtin/builtin.c.v:83: at panic_debug: Backtrace
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/ast/table.v:86: by v__ast__default_table_panic_handler
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/ast/table.v:92: by v__ast__Table_panic
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/ast/table.v:703: by v__ast__Table_final_sym
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/fn.v:2587: by v__checker__Checker_spawn_expr
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/checker.v:2891: by v__checker__Checker_expr
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/checker.v:2123: by v__checker__Checker_stmt
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/checker.v:2665: by v__checker__Checker_stmts_ending_with_expression
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/checker.v:2633: by v__checker__Checker_stmts
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/fn.v:427: by v__checker__Checker_fn_decl
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/checker.v:2157: by v__checker__Checker_stmt
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/checker.v:261: by v__checker__Checker_check
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/checker/checker.v:323: by v__checker__Checker_check_files
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/builder/builder.v:132: by v__builder__Builder_middle_stages
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/builder/builder.v:159: by v__builder__Builder_front_and_middle_stages
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/builder/cbuilder/cbuilder.v:71: by v__builder__cbuilder__gen_c
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/builder/cbuilder/cbuilder.v:59: by v__builder__cbuilder__build_c
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/builder/cbuilder/cbuilder.v:49: by v__builder__cbuilder__compile_c
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/builder/rebuilding.v:324: by v__builder__Builder_rebuild
/tmp/v_1000/../../../../../../home/jorge/v/vlib/v/builder/compile.v:17: by v__builder__compile
/tmp/v_1000/../../../../../../home/jorge/v/cmd/v/v.v:187: by main__rebuild
/tmp/v_1000/../../../../../../home/jorge/v/cmd/v/v.v:145: by main__main
/tmp/v_1000/../../../../../../tmp/v_1000/vdbg.01J3B6A8SEC9MTE5A75DS8Q98Y.tmp.c:44802: by main

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@felipensp felipensp added Bug This tag is applied to issues which reports bugs. Unit: Checker Bugs/feature requests, that are related to the type checker. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. and removed Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. labels Jul 21, 2024
@felipensp felipensp self-assigned this Jul 22, 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. Unit: Checker Bugs/feature requests, that are related to the type checker.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants