Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Error: There are no available ports between 8000 and 9000 for debugging #46

Closed
Cliffback opened this issue Apr 24, 2024 · 26 comments
Closed

Comments

@Cliffback
Copy link
Contributor

I'm running mdbook-pdf using the docker image, but I'm getting Error: There are no available ports between 8000 and 9000 for debugging. I have tried opening port 8080 in the image, but the issue persists. Seems like the issue is related to rust-headless-chrome.

How would I get around this issue (if possible on my end)?

I'm running docker through Colima on my mac

@HollowMan6
Copy link
Owner

Looks like it's related to rust-headless-chrome/rust-headless-chrome#300

Haven't tested that Docker image for a while, maybe it's because of the dependencies.

@HollowMan6
Copy link
Owner

I tested both the latest and 0.1.8 tags of the Docker image on my computer with Docker (Linux, amd64), and both work fine. Not sure what's going on on your side, maybe it's more related to Colima's issue.

@Cliffback
Copy link
Contributor Author

Thanks for the clarification, sounds like the issue might be with Colima. Do you open any port when running the docker image?

@HollowMan6
Copy link
Owner

No, the Chromium is running inside the container, no port is needed to be exposed to the host.

@HollowMan6
Copy link
Owner

One possibility is that Chromium failed to start in Colima.

@Cliffback
Copy link
Contributor Author

I had to run Colima in x86_64 mode with rosetta, then everything ran fine.

Problem probably was that the image was built for x86 and not arm, and then caused problems with Chromium?

@HollowMan6
Copy link
Owner

Ah, so you are using Mac M1/M2/M3 and your platform is not amd64? Then the method you mentioned here is actually misleading: #45 You need to match the image architecture with your computer. I haven't added the aarch64 support in CI for that Docker image and I'll do it now. https://github.com/HollowMan6/mdbook-pdf/blob/main/.github/workflows/docker-publish.yml#L72 If everything works fine, I'll revert #45, if not, I'll let you know and feel free to add more detailed description about this on top of #45

@Cliffback
Copy link
Contributor Author

Ah, I see! That is correct, I'm on M2 Max.

My bad! By my googling, the platform specification had seemed to resolve issues in similar situations when running inside a VM, so I thought it was applicable, but I see now that this might not have been the correct solution in this case. Now I'm getting lot's of these issues: 2024-04-25 08:05:32 [WARN] (mdbook::preprocess::cmd): Command: cargo run -p mdbook-external-links --locked --release -- when doing docker run, which I didn't get before, so looks like it just lead to more issues, haha.

I'll give the updated image a go as soon as it is available

@HollowMan6
Copy link
Owner

Now we have the arm64 image https://hub.docker.com/layers/hollowman6/mdbook-pdf/latest/images/sha256-90654aba3daa6a48cfec434271e9ec3f9241e3b9c69f643c4a6f6a7859c5ce33?context=explore. You can try with that image again and see how it goes now. I expect everything to be fine, so I'll close this issue now. Feel free to let me know if you have further questions!

@Cliffback
Copy link
Contributor Author

Thanks! Now it works fine to run the build, but I'm getting these warnings when trying to use the image. Do you have any idea on how to fix? Or shall I open an additional issue?

Btw. thanks for being so helpful and responsive :D

2024-04-25 13:13:12 [INFO] (mdbook::book): Book building has started
2024-04-25 13:13:12 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "external-links" preprocessor installed?
2024-04-25 13:13:12 [WARN] (mdbook::preprocess::cmd): 	Command: cargo run -p mdbook-external-links --locked --release --
2024-04-25 13:13:12 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "pandocs" preprocessor installed?
2024-04-25 13:13:12 [WARN] (mdbook::preprocess::cmd): 	Command: cargo run -p pandocs-preproc --locked --release --
2024-04-25 13:13:12 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "toc" preprocessor installed?
2024-04-25 13:13:12 [WARN] (mdbook::preprocess::cmd): 	Command: cargo run -p mdbook-toc --locked --release --
2024-04-25 13:13:12 [INFO] (mdbook::book): Running the html backend
2024-04-25 13:13:14 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "external-links" preprocessor installed?
2024-04-25 13:13:14 [WARN] (mdbook::preprocess::cmd): 	Command: cargo run -p mdbook-external-links --locked --release --
2024-04-25 13:13:14 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "pandocs" preprocessor installed?
2024-04-25 13:13:14 [WARN] (mdbook::preprocess::cmd): 	Command: cargo run -p pandocs-preproc --locked --release --
2024-04-25 13:13:14 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "toc" preprocessor installed?
2024-04-25 13:13:14 [WARN] (mdbook::preprocess::cmd): 	Command: cargo run -p mdbook-toc --locked --release --

@Cliffback
Copy link
Contributor Author

Oh, I see in the README.md, that this is probably due to them not being installed on my machine. I'll try that first

@HollowMan6
Copy link
Owner

Oh, I see in the README.md, that this is probably due to them not being installed on my machine. I'll try that first

Yes, these are other dependencies, but remember to download the Linux arm64 binaries/use a container to build the binaries, don't directly download the Mac executable / build on your Mac as that won't work.

@Cliffback
Copy link
Contributor Author

Ah, I see. I find no published binaries for arm64 for these, so i guess I have to compile them with a container.

Thanks for helping out :)

@Cliffback
Copy link
Contributor Author

Got it working. If useful for anyone else, I made a Dockerfile that takes in Cargo plugins as arguments to build them. https://github.com/Cliffback/rust-plugin-builder-docker

To actually use the compiled binaries, I had to do it for each one (probably exists a better way)

docker run --rm \                                                                                                                                                                                         
  -v .:/book \
  -v ~/.tmp/cargo/bin/mdbook:/mdbook \
  -v ~/.tmp/cargo/bin/mdbook-toc:/mdbook-toc \
  -v ~/.tmp/cargo/bin/mdbook-pandoc:/mdbook-pandoc \
  -v ~/.tmp/cargo/bin/mdbook-external-links:/mdbook-external-links \
  hollowman6/mdbook-pdf

@HollowMan6
Copy link
Owner

Some comments:

  1. Actually, there's no need for you to compile mdBook, we already have a specialized version of mdBook with patches (see the Common issue 2 & 3) in the Docker image and it's already available.
  2. I already include /mdbook into the path, so there's no need to separately list and map each binary, just include the parent folder, as suggested in the README. In your case, this would be:
docker run --rm \                                                                                                                                                                                         
  -v .:/book \
  -v ~/.tmp/cargo/bin:/mdbook \
  hollowman6/mdbook-pdf

image

@Cliffback
Copy link
Contributor Author

I tried that first, but then got warnings that none of the plugins were found. Didn’t work until I explicitly listed each plugin.

@HollowMan6
Copy link
Owner

That's interesting, it worked when I tried on my Linux machine with the method I mentioned above. Anyway, it's good if what you have tried works.

@Cliffback
Copy link
Contributor Author

Yeah, could be something with my setup, or related to either macOS or Colima idk :)

@SeWieland
Copy link

I've got the very same issue, completely unrelated to macOS.
I'm running mdbook jobs via runners of the kubernetes executor of a GitLab instance, all Linux based.

I'm using a custom Dockerimage based on rust:1.80.0-bookworm with chromium installed via APT, mdbook v0.4.40-x86_64-unknown-linux-gnu and mdbook-pdf v0.1.8 installed via cargo.

All jobs producing a PDF output are hanging and not executing anymore

@HollowMan6
Copy link
Owner

All jobs producing a PDF output are hanging and not executing anymore

Did it work before and suddenly become not working now? The issue should be more related to rust-headless-chrome and looks like they have a new release recently. https://github.com/rust-headless-chrome/rust-headless-chrome/releases/tag/1.0.12

@HollowMan6
Copy link
Owner

Okay, looks like the CI failed here as well https://github.com/HollowMan6/mdbook-pdf/actions/runs/10250872025

@HollowMan6 HollowMan6 reopened this Aug 5, 2024
@HollowMan6
Copy link
Owner

Related to rust-headless-chrome/rust-headless-chrome#500 Should be fixed in c9dbeba, will release a new version soon.

@SeWieland
Copy link

Thank you for the fix!
Sadly for me the issue remains. It just fails a lot faster after switching to v0.1.9.
I see that your C-I jobs are running again, so I assume some error on my side. I'll add a comment here again if I find something noteworthy.

@HollowMan6
Copy link
Owner

I assume some error on my side. I'll add a comment here again if I find something noteworthy.

I would suggest you to check if you can actually start Chrome in your environment, it should be related to Chrome crashes.

@SeWieland
Copy link

Ahh.. Thanks. Starting up chromium resolved my issues.
My cheap Dockerfile still ran everything as root and Running as root without --no-sandbox is not supported. by chromium.

This flag is now gone with the workaround fix. I don't know if you could re-add it, I guess many others will probably run into this issues soon as well. Anyways - switching the user resolves the problem.

@HollowMan6
Copy link
Owner

Now I realize that the problem should be that I re-enabled the sandbox (I forgot the reason why we needed that yesterday), while the sandbox is not supported in a container environment, so I just disabled it again (v0.1.10), and it should get back to work after the new release.

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

No branches or pull requests

3 participants