microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.45k stars 822 forks source link

timer_create not implemented! #307

Closed MadcowD closed 7 years ago

MadcowD commented 8 years ago

After installing pandoc using apt-get, I get the following error on build 14332: pandoc: timer_create: Function not implemented.

Clearly this function is not implemented on the os-level. See http://man7.org/linux/man-pages/man2/timer_create.2.html

Thanks,

fredzannarbor commented 8 years ago

I have this issue too and it is on my critical path.

stehufntdev commented 8 years ago

Thanks for reporting the issue, I confirmed WSL currently does not have time_create implemented. Can you please add it to our UserVoice page so we can prioritize?

sunilmut commented 8 years ago

Just FYI that you can also view the list of implemented syscalls in the "Release Notes" under the "Syscall" support section.

fredzannarbor commented 8 years ago

Got it. As an FYI apparently this syscall is required for all Haskell binaries.

Open source https://github.com/fredzannarbor/pagekicker-community/wiki

On Wed, May 4, 2016 at 8:26 PM, Sunil Muthuswamy notifications@github.com wrote:

Just FYI that you can also view the list of implemented syscalls in the "Release Notes" https://msdn.microsoft.com/en-us/commandline/wsl/release_notes under the "Syscall" support section.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/307#issuecomment-217046450

Eduardogbg commented 8 years ago

I'm having this problem too and need to run GHC and Cabal on Linux (they need the timer_create() syscall) . Besides installing Linux (VM, dualboot etc) how can I do this? Is there any way of implementing it myself or is it unfeasable?

oscarvarto commented 8 years ago

I am also hit by this issue :( Haskell Stack fails with this error:

$ stack
stack: timer_create: Function not implemented
yarikoptic commented 8 years ago

Also hit this issue while trying to use git-annex (written in Haskell as well)

sp4ghet commented 8 years ago

Also got this using elm-lang (the compiler is written in haskell)

fredzannarbor commented 8 years ago

Does anyone know why Haskell needs this timer_create function and other languages don't necessarily? ᐧ

Open source: https://github.com/fredzannarbor/pagekicker-community/wiki iOS : https://itunes.apple.com/us/app/pagekicker/id1079882706?ls=1&mt=8 Android: https://play.google.com/store/apps/details?id=com.pagekicker.www&hl=en Enterprise: https://www.PageKicker.com

On Fri, Jun 24, 2016 at 3:08 PM, Rikuo Hasegawa notifications@github.com wrote:

Also got this using elm-lang (the compiler is written in haskell)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/307#issuecomment-228434481, or mute the thread https://github.com/notifications/unsubscribe/ABHJyyPdGjAkJPQAcVXLyWpjLuHxy6YUks5qPCsugaJpZM4IThCC .

jdriordan commented 8 years ago

It may be that it doesn't necessarily need it. See: https://mail.haskell.org/pipermail/beginners/2009-June/001817.html

It may be that compiling with -threaded is a workaround, although I haven't tried it.

michallepicki commented 8 years ago
  1. Users should not be forced to recompile from source every haskell program with special compiler settings.
  2. Users should be able to use closed-source haskell programs.
benhillis commented 8 years ago

@jdriordan thank you for suggesting a workaround. @michallepicki agreed on both points. The timer_create system call is on our backlog and we plan to implement it.

nh2 commented 8 years ago

Does anyone know why Haskell needs this timer_create function and other languages don't necessarily?

@fredzannarbor The GHC Haskell runtime supports preemtive scheduling of cooperative threads ("green threads"). In non-preemtive cooperative threading, threads yield to each other. However, when a thread goes into a syscall, it no longer has the control to yield. The only way to wake up from a syscall (and thus to decide wether another thread should be scheduled, inside the runtime, and thus to get preemtive scheduling), is to send a signal to the process that's blocked in the syscall; then the syscall gets interrupted with EINTR and the runtime can do its scheduling decision, and then resume the syscall if needed.

This signal sending is done by setting up a periodic "timer signal" that sends SIGALRM to the process every 10 ms (by default). My guess is that that's done using timer_create.

You may try running the Haskell program with +RTS -V0 to disable the timer signal. See https://downloads.haskell.org/~ghc/7.10.3/docs/html/users_guide/runtime-control.html#rts-options-misc But not sure if that's going to solve it, as there may be other things that need timer_create.

profix898 commented 8 years ago

Same problem here. Is there a UserVoice page (as suggested by @stehufntdev) to vote for priority?

aseering commented 8 years ago

Looks like there's one here:

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13572504-add-support-for-timer-create

In general, you can find UserVoices by going to the main page and searching:

https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo

i2000s commented 8 years ago

I encountered this problem when I tried to use pandoc in Bash. I guess since pandoc is written in Haskell, it should be a haskell-implementation problem. Any updates?

stehufntdev commented 8 years ago

Thanks for trying out WSL. The timer_create system call is on our backlog and we plan to implement it. We've been prioritizing our work based on the user voice page so please vote there: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/13572504-add-support-for-timer-create.

Qinka commented 8 years ago

so dose ghc

EricGT commented 8 years ago

Same problem with Agda.

Details

Using Windows command prompt

lxrun /uninstall /full
bash

then using WSL

sudo apt-get update
sudo apt-get upgrade
sudo rm /etc/hosts
exit

and then restarting WSL to build new /etc/hosts.

When installing Agda

sudo apt-get install agda

Error:

Setting up ghc (7.6.3-10) ...
ghc: timer_create: Function not implemented

Build version obtained using command prompt: Microsoft Windows [Version 10.0.14393]

octetta commented 8 years ago

For those of you here because of the timer_create error when running pandoc, I've worked around this by setting the following alias:

alias pandoc='pandoc +RTS -V0 -RTS`

or by using an environment variable:

export GHCRTS=-V0

One note/warning: I've only tested this with the HTML and PDF generation options of pandoc.

(thanks to @nh2 for the clues...)

michaelkpate commented 8 years ago

Just to add in - just installed Pandoc and googled this when I tried to run it.

i2000s commented 8 years ago

@octetta I think the trick was to turn off the timer_create (maybe not?), but do you know if there is a better way to make it work for the Pandoc markdown in Jekyll? Your trick doesn't work in Jekyll. I have tried using export GHCRTS=-V0 to turn the timer off, but still got an error

jekyll 3.1.6 | Error: pandoc: Error running filter pandoc-citeproc 
pandoc-citeproc not found in path

But if I run echo $PATH, the pandoc-citeproc installation path is definitely on the list. Everything works in a real Ubuntu system, but not in WSL.

octetta commented 8 years ago

@i2000s, I've never used pandoc-citeproc before, but I just apt-get'ed it and when I ran it with either the export or by putting the options on the command-line, I see this message:

pandoc-citeproc: Most RTS options are disabled. Link with -rtsopts to enable them.

...this leads me to believe that pandoc-citeproc truly requires the pre-emptive thread capability that timer_create is being use for in the Haskell run-time.

Without looking at pandoc or Haskell run-time code, I suspect you're stuck until the WSL team adds this syscall.

BTW, I think Jekyll (or pandoc?) isn't properly interpreting the return code from when it tries to run pandoc-citeproc giving you a false error about the program not being in the path.

i2000s commented 8 years ago

@octetta Thank you for the comment. I agree with you, there are some fishy connections between packages and implementing timer_create would be the ultimate fix in WSL. Current workarounds as we have pointed out only work for cases where timer_create is not really needed.

EricGT commented 8 years ago

Same problem (ghc-pkg: timer_create: Function not implemented) with The Maude System

sudo apt-get install maude

Currently there are three programming languages (GHC, Agda, Maude) that I would like to use with WSL that can be resolved with the one issue. The plus side about this is that Agda and Maude are using GHC so fixing it for GHC should hopefully resolve the same problem with Agda and Madue without any extra work. :-)

nh2 commented 8 years ago

this leads me to believe that pandoc-citeproc truly requires the pre-emptive thread capability that timer_create is being use for in the Haskell run-time

@octetta I doubt it, I don't see a reason why pandoc-citeproc would require preemtive threading in order to function. More likely it was simply not built with the -rtsopts option, so that you can't override them, and if you built pandoc-citeproc yourself and used -rtsopts during compilation (or petitioned the maintainer to have that happen by default), it would probably work.

BTW, I think Jekyll (or pandoc?) isn't properly interpreting the return code from when it tries to run pandoc-citeproc giving you a false error about the program not being in the path.

That sounds like a but that should be reported.

DSigmund commented 8 years ago

Also not working for pandoc...

ktor commented 8 years ago

As well not working for elm-language

sunilmut commented 8 years ago

Thanks for the feedback, everyone. As you have already realized, timer_create syscall is currently not supported by WSL. If you would like to see better support for scenario\software such as pandoc, please help us prioritize that by voicing your opinion (up vote) in our user voice page

jeetparikh commented 8 years ago

I would like to this feature coming soon :).

i2000s commented 8 years ago

@SRGOM The rank you were talking about may not be based on the voting number, rather it could be based on the latest update/comment time stamp. I checked the voting number rank, this feature is way behind. While there are whole bunch of other threads Microsoft people have claimed to work on them, Microsoft people haven't even commented on this small but profound function.

In case anyone has missed the voting thread, please cast your vote here.

stehufntdev commented 8 years ago

Thanks for the feedback everyone. Currently we're prioritizing new functionality like this with UserVoice so please make sure to vote.

karljs commented 8 years ago

@stehufntdev Does that mean that massive feature requests like adding X11 or GPU support with lots of votes outweigh missing core POSIX features regardless of implementation complexity? I don't mean to come across as entitled as this will probably sound, but this issue is already on the first page of the top UserVoice entries and one of the top three or so requests that don't seem to be big-time integration projects, and yet nobody has tagged or commented on it there yet.

i2000s commented 8 years ago

@karljs As I have observed in my earlier post, the ranking you pointed out is Not sorted based on the voting number. This issue only got 252 votes now, while issues which have comments from Microsoft people could only have 166 votes (the only on Add NETLINK Socket support, for example) on the first page. However, when you turn to the second page, there are two issues which got Microsoft's comment of "Working on it" having only 3 and 5 votes--they are about "iproute2" and "mouse support for curses applications". I feel this game really depends on if any Microsoft people would like to work on a particular issue and hence the difficulty of the issue. Since this project is closed source, we can hardly do anything on solving them. The github repo here may be useless for solving problems, and could be a place to waste our time!

karljs commented 8 years ago

@i2000s I'm inclined to agree with you, but I actually did sort the page by "top", which I can only assume is based on votes and not something else. This timer_create issue is at the very bottom of the first page there.

i2000s commented 8 years ago

@karljs Makes sense it's on page one, but when I read your comment with one of the top three or so requests that don't seem to be big-time integration projects, I thought you are looking at the default sorting page. Sorry about that. Anyway, more people should start using the Microsoft User Voice page. That's the take-away message of my conclusion.

ztl8702 commented 8 years ago

Encountered this issue when using git annex.

radix commented 8 years ago

Does anyone know if LD_PRELOAD works on WSL? Maybe timer_create could be implemented as a preload hack...

aseering commented 8 years ago

Yes it does! I have used it to hack around other missing functionality in the past.

ztl8702 commented 8 years ago

@radix What value should I set LD_PRELOAD to?

Sudha247 commented 8 years ago

Although it's obvious, I got the same issue while installing ghc.

brcolow commented 8 years ago

I encountered this issue when trying to run shellcheck although since WSL is 14.04 the version of shellcheck is quite ancient...I will probably try compiling it from source and see if it still needs that syscall.

benhillis commented 8 years ago

I'm happy to report that I've checked in support for the posix timer family of system calls (timer_create, timer_delete, timer_settime, timer_gettime, timer_getoverrun). I have tried many of the applications in this thread to verify they are unblocked including: ghc, shellcheck, pandoc, and maude. This will be coming in an upcoming Windows Insider build.

The implementation is mostly complete with two caveats (due to realtime signal functionality - which is on the backlog):

  1. Overrun count (will always return 0).
  2. If you create multiple timers that deliver the same signal number, you may miss some expirations. This is because currently we do not queue signals.

In practice it seems most applications do not rely on this functionality, and I'm looking at resolving those two issues.

Edit: After some initial testing it looks like even the native Linux kernel doesn't handle 2 above.

jmchapman commented 8 years ago

Great news!

On Mon, Oct 31, 2016, 7:55 PM Ben Hillis notifications@github.com wrote:

I'm happy to report that I've checked in support for the posix timer family of system calls (timer_create, timer_delete, timer_settime, timer_gettime, timer_getoverrun). I have tried many of the applications in this thread to verify they are unblocked including: ghc, shellcheck, pandoc, and maude. This will be coming in an upcoming Windows Insider build.

The implementation is mostly complete with two caveats (due to realtime signal functionality - which is on the backlog):

  1. Overrun count (will always return 0).
  2. If you create multiple timers that deliver the same signal number, you may miss some expirations. This is because currently we do not queue signals.

In practice it seems most applications do not rely on this functionality, and I'm looking at resolving those two issues.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/BashOnWindows/issues/307#issuecomment-257401993, or mute the thread https://github.com/notifications/unsubscribe-auth/AAn0LADTs6hYHxqYGOdgRyUuh73OQSVkks5q5keQgaJpZM4IThCC .

EricGT commented 8 years ago

@benhillis If you write a book about what you and the others learned and how you and the others managed to get these workarounds to work for WSL, I would surely buy it. One of my favorite books was Inside Windows NT and having something similar for WSL would be a win.

dsouflis commented 8 years ago

Unsurprisingly, installing Purescript has the same 'timer_create' issue during stack setup && stack install. Looking forward for the resolution.

EricGT commented 8 years ago

FYI

After seeing that this has been fixed I decided to see if it worked for maude even though I am NOT using the Windows Insider Program. I obviously did an update and upgrade. To my amazement/concern I was able to get a successful install using sudo apt-get install maude and run the first example from the manual

As of this writing 11/6/2016 I and using "Microsoft Windows [Version 10.0.14393]" which is from the banner of a command prompt and is not the latest release version of WSL which is at 14595.

TL;DR

First example

Create Maude source file my-nat.maude I did this using a GUI editor in Windows, e.g. Visual Studio Code, in directory
C:\Users\Eric\Projects\Maude Intro.


fmod SIMPLE-NAT is
    sort Nat .
    op zero : -> Nat .
    op s_ : Nat -> Nat .
    op _+_ : Nat Nat -> Nat .
    vars N M : Nat .
    eq zero + N = N .
    eq s N + M = s (N + M) .
endfm

Create symlink from WSL to Windows so that the Windows directory Maude Intro appears in the WSL directory maude


eric@WINDOWS-6F874NS:~/$ ln -s "/mnt/c/Users/Eric/Projects/Maude Intro" /home/eric/maude
eric@WINDOWS-6F874NS:~$ cd maude
cd maude
eric@WINDOWS-6F874NS:~/maude$ ll
ll
total 4
drwxrwxrwx 2 eric eric  0 Nov  6 09:58 ./
drwxr-xr-x 2 eric eric  0 Nov  6 09:58 ../
lrwxrwxrwx 1 eric eric 67 Nov  6 11:36 Maude Intro -> /mnt/c/Users/Eric/Projects/Maude Intro/
eric@WINDOWS-6F874NS:~/maude$ cd "Maude Intro"
cd "Maude Intro"
eric@WINDOWS-6F874NS:~/maude/Maude Intro$

Start Maude, load the code and run an example.


eric@WINDOWS-6F874NS:~/maude/Maude Intro$ maude
                     \||||||||||||||||||/
                   --- Welcome to Maude ---
                     /||||||||||||||||||\
            Maude 2.6 built: Oct 24 2013 11:22:40
            Copyright 1997-2010 SRI International
                   Sun Nov  6 11:39:26 2016
Maude> load my-nat.maude
Maude> reduce in SIMPLE-NAT : s s zero + s s s zero .
reduce in SIMPLE-NAT : s s zero + s s s zero .
rewrites: 3 in 0ms cpu (0ms real) (~ rewrites/second)
result Nat: s s s s s zero
Maude>
PowerSnail commented 8 years ago

Has this fix been released yet? I am at Insider Build 14959, and still not getting timer_create. Does it require reinstalling Bash on Windows, or should I simply wait for the next Insider Update? I have always been confused with how Bash on Windows itself updates.

Thank you.

benhillis commented 8 years ago

@PowerSnail It is not yet publicly available - keep an eye on the release notes. When timer_create reaches the Insider build you will not need to reinstall Bash on Windows.

madskristiansen commented 8 years ago

Please release :)

Love the WSL project. Currently hitting the timer_create issue with Pandoc.