Stream: git-wasmtime

Topic: wasmtime / issue #7420 Failed to get the clock time ?


view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2023 at 13:04):

orangeC23 added the bug label to Issue #7420.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2023 at 13:04):

orangeC23 opened issue #7420:

Steps to Reproduce

(1) The cfile is :

#define _POSIX_C_SOURCE 199309L // 用于启用 clock_gettime 函数

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int clock_time_get(clockid_t clock_id) {
    struct timespec tp;

    if (clock_gettime(clock_id, &tp) == 0) {
        printf("Successfully get the clock time.\n");
        printf("seconds: %ld\n", tp.tv_sec);
        printf("nano seconds: %ld\n", tp.tv_nsec);
    } else {
        perror("Failed to get the clock time.\n");
        return 1;
    }

    return 0;
}

int clock_time_getyq5TE7BLv8 (){
    clockid_t clock_id = CLOCK_PROCESS_CPUTIME_ID;
    return clock_time_get(clock_id);
}

int main() {
    clock_time_getyq5TE7BLv8 ();
}

(2)compile the c file into wasm: ./wasi-sdk-16.0/bin/clang --target=wasm32-unkown-wasi --sysroot=./wasi-sdk-16.0/share/wasi-sysroot clock2.c -o clock2.wasm
(3)exeute clock.wasm
wasmtime run clock2.wasm

Expected Results

Using gcc clock2.c -o clock2 and ./clock2 to execute get the following result:

Successfully get the clock time.
seconds: 0
nano seconds: 6283516

And wamr, wasmedge,wasmer also print the above message.

Actual Results

wasmtime prints:

Failed to get the clock time.
: Bad file descriptor

I'm not sure whether this is a bug. Maybe this is related to https://github.com/bytecodealliance/wasmtime/issues/7419
Sorry for bothering you. Thanks a lot !

Versions and Environment
wasmtime 13.0.0
Operating system: Ubuntu 20.04

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2023 at 13:22):

bjorn3 commented on issue #7420:

https://github.com/bytecodealliance/wasmtime/blob/2f83f97c9f4f7f98750eb2be19a336339da931e2/crates/wasi-common/src/snapshots/preview_1.rs#L74

process and thread clocks are not supported

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2023 at 13:22):

orangeC23 commented on issue #7420:

Thanks a lot !

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2023 at 13:23):

orangeC23 closed issue #7420:

Steps to Reproduce

(1) The cfile is :

#define _POSIX_C_SOURCE 199309L // 用于启用 clock_gettime 函数

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int clock_time_get(clockid_t clock_id) {
    struct timespec tp;

    if (clock_gettime(clock_id, &tp) == 0) {
        printf("Successfully get the clock time.\n");
        printf("seconds: %ld\n", tp.tv_sec);
        printf("nano seconds: %ld\n", tp.tv_nsec);
    } else {
        perror("Failed to get the clock time.\n");
        return 1;
    }

    return 0;
}

int clock_time_getyq5TE7BLv8 (){
    clockid_t clock_id = CLOCK_PROCESS_CPUTIME_ID;
    return clock_time_get(clock_id);
}

int main() {
    clock_time_getyq5TE7BLv8 ();
}

(2)compile the c file into wasm: ./wasi-sdk-16.0/bin/clang --target=wasm32-unkown-wasi --sysroot=./wasi-sdk-16.0/share/wasi-sysroot clock2.c -o clock2.wasm
(3)exeute clock.wasm
wasmtime run clock2.wasm

Expected Results

Using gcc clock2.c -o clock2 and ./clock2 to execute get the following result:

Successfully get the clock time.
seconds: 0
nano seconds: 6283516

And wamr, wasmedge,wasmer also print the above message.

Actual Results

wasmtime prints:

Failed to get the clock time.
: Bad file descriptor

I'm not sure whether this is a bug. Maybe this is related to https://github.com/bytecodealliance/wasmtime/issues/7419
Sorry for bothering you. Thanks a lot !

Versions and Environment
wasmtime 13.0.0
Operating system: Ubuntu 20.04

Architecture: x86_64

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2023 at 13:23):

bjorn3 edited a comment on issue #7420:

https://github.com/bytecodealliance/wasmtime/blob/2f83f97c9f4f7f98750eb2be19a336339da931e2/crates/wasi-common/src/snapshots/preview_1.rs#L103

process and thread clocks are not supported

view this post on Zulip Wasmtime GitHub notifications bot (Oct 31 2023 at 16:36):

pchickey commented on issue #7420:

@orangeC23 Can you please perform some investigation of your own into these issues before filing them? You are filing more issues than any other contributor, in a manner which appears to be the result of some automated system, and as far as I can tell, all of these issues have trivial answers which would only require you to examine a small amount of code.

We appreciate that @bjorn3 and @alexcrichton and others have taken a look at these, but it isn't very fair for you to consume their time and attention if you aren't showing that you are putting time and attention into these issues yourself.


Last updated: Nov 22 2024 at 16:03 UTC