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

hexo server fails to update content after a while (3.0.0) #1175

Closed
steckerhalter opened this issue Apr 4, 2015 · 25 comments
Closed

hexo server fails to update content after a while (3.0.0) #1175

steckerhalter opened this issue Apr 4, 2015 · 25 comments

Comments

@steckerhalter
Copy link

When I work on a post or page after a few minutes a browser refresh does not update the content anymore. Any new changes I make to the file are not reflected and I need to kill the server and start it again to pick up the changes (which only works for a few minutes again)

@Xuanwo
Copy link
Contributor

Xuanwo commented Apr 10, 2015

I have the same problem.

@steckerhalter
Copy link
Author

I have updated to 3.1.1 and still get this issue. I tried switching node versions, removed the modules and did a clean install but it still fails to update the draft I'm working on. Any ideas?

@jamespan
Copy link

I catch the same problem these days. Several days ago, I build a docker image with hexo 3.0.1 and it can update contents.

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "3.0.1"
  },
  "dependencies": {
    "hexo": "^3.0.0",
    "hexo-generator-archive": "^0.1.0",
    "hexo-generator-category": "^0.1.0",
    "hexo-generator-index": "^0.1.0",
    "hexo-generator-tag": "^0.1.0",
    "hexo-renderer-ejs": "^0.1.0",
    "hexo-renderer-stylus": "^0.2.0",
    "hexo-renderer-marked": "^0.2.4",
    "hexo-server": "^0.1.2",
    "hexo-generator-sitemap": "~1.0.1",
    "hexo-generator-feed": "~1.0.1",
    "hexo-deployer-git": "0.0.4"
  }
}

On my Mac I tried hexo 3.0.1 3.1.0 3.1.1 and it doesn't work.

@steckerhalter
Copy link
Author

@jamespan So do you think it's related to the OS? What was the docker image based on?

@jamespan
Copy link

@steckerhalter ubuntu 14.04. I am not really sure, but the hero-fs module related on fsevents, which is os x only

@steckerhalter
Copy link
Author

@jamespan ok, I'm having the issue on Debian Linux btw.

@jamespan
Copy link

@steckerhalter I found a really weird situation. My hexo blog was in ~/Sites/blog, and it can't update content. But when I moved the directory to ~/, it can update content like it used to be.

I don't know why this happens, maybe you can try.

@steckerhalter
Copy link
Author

@jamespan I experimented a bit (renamed the folder etc.) and could make it update the content once over a longer period. Then it fell back to just update for like one minute or something. Quite weird.

@morris821028
Copy link

@steckerhalter
I agree with you. When my blog has 700+ articles, updating the content in latest articles will make hexo server lock in several minutes, and I can't view website on chrome or firefox.

Yang@MORRIS /d/morris821028.github
$ hexo -v
hexo: 3.1.1
os: Windows_NT 6.3.9600 win32 x64
http_parser: 2.3
node: 0.12.0
v8: 3.28.73
uv: 1.0.2
zlib: 1.2.8
modules: 14
openssl: 1.0.1l

@xcodebuild
Copy link
Member

My hexo blog is just in ~/blog,not work.

hexo -v
hexo-cli: 0.1.8
os: Linux 2.6.32-042stab108.8 linux ia32
http_parser: 2.0
node: 0.10.36
v8: 3.14.5.10
ares: 1.9.1
uv: 0.10.34
zlib: 1.2.3
modules: 11
openssl: 1.0.1e-fips

@xcodebuild
Copy link
Member

I tried hexo generate --watch,when I update a post,there is nothing except INFO Generated: css/main.css

@xcodebuild
Copy link
Member

Also,hexo server --debug print DEBUG Updated: source/_posts/balbala.org at the first time I update file.Then get DEBUG Unchanged: source/_posts/balbala.org every time I redo it.

Here is details:

06:08:43.445 DEBUG **Updated**: source/_posts/use-orgmode-with-hexo.org
06:08:43.549 DEBUG Processed: _posts/use-orgmode-with-hexo.org
06:08:43.646 DEBUG Generator: page
06:08:43.646 DEBUG Generator: post
06:08:43.646 DEBUG Generator: archive
06:08:43.647 DEBUG Generator: category
06:08:43.647 DEBUG Generator: index
06:08:43.647 DEBUG Generator: tag
06:08:43.649 DEBUG Generator: asset
06:09:04.047 DEBUG **Unchanged**: source/_posts/use-orgmode-with-hexo.org
06:09:04.148 DEBUG Processed: _posts/use-orgmode-with-hexo.org
06:09:04.224 DEBUG Generator: page
06:09:04.224 DEBUG Generator: post
06:09:04.225 DEBUG Generator: archive
06:09:04.225 DEBUG Generator: category
06:09:04.225 DEBUG Generator: index
06:09:04.225 DEBUG Generator: tag
06:09:04.228 DEBUG Generator: asset

What i meet might be a different thing with others.Everytime I use emacs tramp(over ssh or scp) to edit&save files this occurs.But when I use vim on ssh to edit it everything is ok.

But I checked sha1sum(when I use tramp),it works well.

# sha1sum use-orgmode-with-hexo.org
2ffd0d1f0ac0542ae176ae1b761ff72ae3f21509  use-orgmode-with-hexo.org
# sha1sum use-orgmode-with-hexo.org
f5a1be6f597c7f7405d79e45863c955cb66bcf90  use-orgmode-with-hexo.org
# sha1sum use-orgmode-with-hexo.org
397f37b5fb689fa7a165e11eae2f632773e1c646  use-orgmode-with-hexo.org

@steckerhalter
Copy link
Author

I thought it's time to investigate this, so for me what happens is that Hexo detects the same sha hash even though the file has been changed. The code where this happens is here: https://github.com/hexojs/hexo/blob/master/lib/box/index.js#L216

Now I just need to find out why the file that obviously has been changed is returning the same hash in hexo.

@steckerhalter
Copy link
Author

there is some transform in there (whatever that is for) and the problem seems to be that it's not executed at all in some cases:

https://github.com/hexojs/hexo/blob/master/lib/box/shasum_stream.js#L16

@steckerhalter
Copy link
Author

so the hash is not updated... if I'm understanding this correctly

@steckerhalter
Copy link
Author

I'm not able to find the solution. It's producing always the same SHA hash. I suppose the bug is somewhere in the nodejs stream interface. I still have no idea why _transform is not executed as it should

@steckerhalter
Copy link
Author

The hash is just wrong. And then it always gets this same wrong hash no matter how the actual hash of the file is.

@steckerhalter
Copy link
Author

The funny hash is da39a3ee5e6b4b0d3255bfef95601890afd80709. I have no idea where it gets that from since the file never has that. Hashing is broken in hexo for some reason (maybe on Linux only?). I resorted to make an exception for the specific hash since it always means the file has been updated 🎅

@Xuanwo
Copy link
Contributor

Xuanwo commented Dec 14, 2015

@sergiolepore How about xxhash? try hexo 3.2-beta, thanks.

@sergiolepore
Copy link
Contributor

@Xuanwo sorry?

@Xuanwo
Copy link
Contributor

Xuanwo commented Dec 14, 2015

@sergiolepore well, I mean we use an another hash tool, this change may resolve the problem, and I hope you can have a try. Sorry for my miss leading.

@sergiolepore
Copy link
Contributor

@Xuanwo I still don't get it... Are you confusing me with @steckerhalter? 😕

@steckerhalter
Copy link
Author

@Xuanwo I think it's better now in the beta. I still saw some cases where it didn't update and that was mostly when the change was a small one and it didn't seem to get picked up, so there might be a new issue creeping up :)

@Xuanwo
Copy link
Contributor

Xuanwo commented Dec 15, 2015

@sergiolepore yes .. 😭

@Xiamu-ssr
Copy link

I tried hexo generate --watch,when I update a post,there is nothing except INFO Generated: css/main.css

this work for me.
my status:

  • wsl2
  • ubuntu18.04
  • docker

when i use command hexo generate -w and i update one of my post , i get

INFO Hexo is watching for file changes. Press Ctrl+C to exit.
INFO Generated: atom.xml
INFO Generated: 2023/04/09/test2-image-tese/index.html
INFO Generated: archives/index.html
INFO Generated: archives/2023/04/index.html
INFO Generated: archives/2023/index.html
INFO Generated: index.html

i know hexo maybe get update so i use command hexo s --debug last, i get my web updated!!
i stop it, i want to know how to let hexo success update resource real time
so i use hexo s --debug again, and then i modify one of my post, i got

08:01:24.095 INFO Hexo is running at http://localhost:4000/ . Press Ctrl+C to stop.
08:01:24.106 DEBUG Database saved
08:01:59.645 DEBUG Processed: _posts/test1.md
08:01:59.749 DEBUG Rendering post: /root/BK/blog/source/_posts/test1.md
08:01:59.768 DEBUG Generator: asset
08:01:59.769 DEBUG Generator: page
08:01:59.769 DEBUG Generator: post
08:01:59.770 DEBUG Generator: atom
08:01:59.785 DEBUG Generator: archive
08:01:59.787 DEBUG Generator: category
08:01:59.787 DEBUG Generator: index
08:01:59.791 DEBUG Generator: tag
08:02:01.260 DEBUG Rendering HTML index: index.html

and in localhost link i see my web is updated.
that save my day!
thanks! although this method doesn't seem to work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants