Giter VIP home page Giter VIP logo

Comments (17)

zhengxiaoyao0716 avatar zhengxiaoyao0716 commented on June 19, 2024 1

@OvermindDL1 As the message guide, I tried to run phx.server as Administrator, and found the priv folder in _build now is a symbol link, and seems no problems.
image

from phoenix_live_reload.

zhengxiaoyao0716 avatar zhengxiaoyao0716 commented on June 19, 2024

Maybe you can take a try, the project ispublic, here the repository: honeycomb-adventure .
And here my environment:
image
Windows 10 Version 1703, Enterprise edition.

Hoped this information can make some help.

from phoenix_live_reload.

josevalim avatar josevalim commented on June 19, 2024

Thank you @zhengxiaoyao0716! It seems this issue is specific to Windows. Since we can't properly use symlinks on Windows, we need to copy the files and something is happening when we copy them.

Pinging @OvermindDL1 in case he has any ideas what may be happening.

from phoenix_live_reload.

zhengxiaoyao0716 avatar zhengxiaoyao0716 commented on June 19, 2024

Well, I'm glad that I could help you. Since this problem may caused by symlinks and only happened on Windows, I'll try to working on other system for the moment.

from phoenix_live_reload.

OvermindDL1 avatar OvermindDL1 commented on June 19, 2024

This is precisely the problem. If you enable symlinks for your user in windows (or run phoenix as administrator) then it works fine. I did a lot of research on that when I had the issue last year, it's documented around here somewhere, but that is the way to solve it on Windows... ^.^;

The issue is that Windows doesn't quite flush and unlock the file and phoenix is too fast to acquire the new files, this becomes especially larger of a problem if you use any virus program at all as their file listen hook slows down file access as well since Windows does not have a well made COW or well-journaled file system.

from phoenix_live_reload.

OvermindDL1 avatar OvermindDL1 commented on June 19, 2024

I thought a message was added at load time that warned you exactly of this and how to fix it as well, wasn't it?

from phoenix_live_reload.

chrismccord avatar chrismccord commented on June 19, 2024

The issue is that... phoenix is too fast ...

:D In all seriousness I don't think we can help this one on our end, but maybe we can include docs somewhere for windows to recommend running as admin?

from phoenix_live_reload.

OvermindDL1 avatar OvermindDL1 commented on June 19, 2024

:D In all seriousness I don't think we can help this one on our end

Lol, more that the beam is too fast because it does not listen for the windows event that says a flush is complete, and even then if an anti-virus exists then it will lock the file before it could be re-opened anyway, thus still causing the same issue... ^.^;

but maybe we can include docs somewhere for windows to recommend running as admin?

I thought it was already documented when a person loads a phoenix server in dev mode on windows, it should print a good sized paragraph talking about exactly this issue and what to do to work around it. I know I last saw it when I last ran the server on windows (thankfully I finally convinced my job to migrate the servers fully to linux, red hat but eh).

from phoenix_live_reload.

OvermindDL1 avatar OvermindDL1 commented on June 19, 2024

Ah, yes indeed it is still there:

https://github.com/phoenixframework/phoenix/blob/8dbb2609dc933b367b8463a4cee62d2f3cde0f8d/lib/phoenix/code_reloader/server.ex#L37

And:

https://github.com/phoenixframework/phoenix/blob/8dbb2609dc933b367b8463a4cee62d2f3cde0f8d/lib/phoenix/code_reloader/server.ex#L81

from phoenix_live_reload.

chrismccord avatar chrismccord commented on June 19, 2024

ah, beautiful. Thanks!

from phoenix_live_reload.

zhengxiaoyao0716 avatar zhengxiaoyao0716 commented on June 19, 2024

@OvermindDL1 Thanks, I found the message, it is just in the third screenshots of the first floor, but I didn't realize it at first that this was the reason of this problem.

from phoenix_live_reload.

zhengxiaoyao0716 avatar zhengxiaoyao0716 commented on June 19, 2024

I have a small idea, the only thing we need is to create some symbol links as Administrator identity for those folders, but we don't need to create them each times at the phx.server task.
We can provide another task to allow user create those symlinks as Administrator identity, then each time that phx.server start, check those symlinks and if they are not exist, give a tip to users that they need manual execute the task as Administrator to generate those symlinks.
Although this way may not the best method and user have to take an extra step, I think this is the most simple patch,.

from phoenix_live_reload.

zhengxiaoyao0716 avatar zhengxiaoyao0716 commented on June 19, 2024

Umm, perhaps we have a easier choise, just change the message like you need to run this task as Administrator at least once time, if user did this and the symbol links already exist, hide the message.

from phoenix_live_reload.

OvermindDL1 avatar OvermindDL1 commented on June 19, 2024

if user did this and the symbol links already exist, hide the message.

Hmm, a check to see if the symlink already exists and points to the correct location might indeed be a good quality-of-life workaround, and only be a line or two of code to implement (if the BEAM has a command to query that information, I'm not actually sure, never used it...). You should PR it? :-)

from phoenix_live_reload.

OvermindDL1 avatar OvermindDL1 commented on June 19, 2024

it is just in the third screenshots of the first floor, but I didn't realize it at first that this was the reason of this problem.

Also, heh, it is, I missed it too. I could have sworn it was red when I had it back on Windows.

from phoenix_live_reload.

zhengxiaoyao0716 avatar zhengxiaoyao0716 commented on June 19, 2024

@OvermindDL1 That is my PR , I tested those code on my windows system locally and they works well, but maybe we need more test on other systems.

In addition, I tried some terminals I can found on my Win10, powershell, cmd, mingw. But none of them can render color with [warn] logger. In my VSCode debug console, the message starts with warning is red, but [warn] logs still can't.

from phoenix_live_reload.

OvermindDL1 avatar OvermindDL1 commented on June 19, 2024

In addition, I tried some terminals I can found on my Win10, powershell, cmd, mingw. But none of them can render color with [warn] logger. In my VSCode debug console, the message starts with warning is red, but [warn] logs still can't.

For note, none of what you listed are terminals but rather are shells. The terminal you were probably using was 'command' (which is pretty horrible, and even Win10 is trying to phase it out). I tend to use conemu as the terminal myself though.

from phoenix_live_reload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.