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

"v run" unexpectedly terminates #19412

Closed
eayus opened this issue Sep 22, 2023 · 5 comments · Fixed by #19471
Closed

"v run" unexpectedly terminates #19412

eayus opened this issue Sep 22, 2023 · 5 comments · Fixed by #19471
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Weird/Undocumented Behaviour This issue is related to a bug, that was surprising and wasted user's time.

Comments

@eayus
Copy link

eayus commented Sep 22, 2023

Describe the bug

The following program has an infinite loop, and should not terminate. However v run main.v terminates without printing anything. This behaviour seems a bit suspicious, and differs from the behaviour if the program is compiled and ran (which segfaults, due to stack overflow).

Reproduction Steps

// main.v
fn forever() {
  forever()
}

fn main() {
  forever()
  
  println('hello world')
}

Run
v run main.v

Expected Behavior

v run to never terminate, or crash

Current Behavior

v run terminates, despite the program having an infinite loop.

Possible Solution

Imo the main thing is that the behaviour should be consistent. Ideally v run prints an error saying a stack overflow has occurred.

Additional Information/Context

No response

V version

Current V version: V 0.4.1 ed42341

Environment details (OS name and version, etc.)

Arch Linux, kernel 6.5.3

Important

You can vote for this issue using the 👍 reaction. More votes increase the issue's priority
for developers.

Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.

@eayus eayus added the Bug This tag is applied to issues which reports bugs. label Sep 22, 2023
@JalonSolov
Copy link
Contributor

It's definitely going to terminate, when you run out of stack. I'm just surprised you're not getting a message from the system about this.

@ArtemkaKun ArtemkaKun added the Weird/Undocumented Behaviour This issue is related to a bug, that was surprising and wasted user's time. label Sep 23, 2023
@spytheman
Copy link
Member

For me, v run x.v exits, with error code 11 .
v x.v then ./x exits with error code 139 and a message Segmentation fault (core dumped) .

@spytheman
Copy link
Member

I think the main problem is that v run x.v just does not print the error message currently.

@spytheman
Copy link
Member

spytheman commented Sep 29, 2023

#139 15:54:06 ᛋ master /space/v/vnew❱v -use-os-system-to-run run a.v 
Terminated by signal 139 (SIGSEGV)
#11 15:56:16 ᛋ master /space/v/vnew❱

This is when -use-os-system-to-run is used (i.e. os.system(), instead of os.new_process()) by v run .

@spytheman
Copy link
Member

PR #19471 should fix this. With it:

#0 16:45:45 ᛋ v_run_show_more_details_on_program_terminated_by_a_signal /space/v/vnew❱v run /v/misc/2023_09_29__16/a.v
Terminated by signal 11 (SIGSEGV)
#139 16:45:50 ᛋ v_run_show_more_details_on_program_terminated_by_a_signal /space/v/vnew❱v -use-os-system-to-run run /v/misc/2023_09_29__16/a.v
Terminated by signal 11 (SIGSEGV)
#139 16:45:55 ᛋ v_run_show_more_details_on_program_terminated_by_a_signal /space/v/vnew❱./v /v/misc/2023_09_29__16/a.v
#0 16:46:05 ᛋ v_run_show_more_details_on_program_terminated_by_a_signal /space/v/vnew❱/v/misc/2023_09_29__16/a
Segmentation fault (core dumped)
#139 16:46:12 ᛋ v_run_show_more_details_on_program_terminated_by_a_signal /space/v/vnew❱

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. Weird/Undocumented Behaviour This issue is related to a bug, that was surprising and wasted user's time.
Projects
None yet
4 participants