-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Possible nightly rustdoc doc generation time / size regression #134435
Comments
@piaoyh does this pathological behavior occur if you remove everything from the crate except BigUInt? |
@workingjubilee Sorry for late reply because of time difference and I have to work at daytime. If I remove everything from my crate except BigUInt and execute Instead, I removed all other modules from my crate except the module number and executed |
I don't know whether the following helps you or not. So, it seems cargo works fine with the argument Usually, when I test documentation, I have always used only When I was asked to try to execute $ cargo Usage: cargo [+toolchain] [OPTIONS] [COMMAND] Options:
|
To clarify the comment above for the people debugging this: I assume @piaoyh is not talking about |
No, I was talking about I tested more.
merry Christmas to all. |
I dramatically reduced the code of my crate for test but still What am I supposed to test to find why docs.rs does not show documentation of my crate
|
I thought that Then, does it mean If so, my question is why the webserver docs.rs fails in building What is the limit size of each source file for publishing crate? Is my source code too big or does Can anyone answer me? |
I think I found the reason! There must be the limitation of the number of methods that can be implemented for struct. SmallUInt is more than 50,000 lines but it's documentation was generated successfully at docs.rs while BigUInt has less than 30,000 lines (I moved a lot of the documentation to other files) but its documentation was not generated at docs.rs. I found that BigUInt has 815 public methods while SmallUInt has 117 methods. I think there must be function number limitation. |
cc @GuillaumeGomez what could we do to debug this? |
Is it related with What does the server Can you let me know it? Probably, most of people here must be too busy to dig my case. If necessary information is provided to me, I'll try to debug though I am also busy for my job. |
Just some remarks from my side:
we can build it, it's only too big to serve.
I think and one HTML page being bigger than megabyte-sized is not a good idea for usability, especially with slower network connections. Unrelated to this bug, which seemed to be an endless loop, I would recommend changing your design so you have smaller pages. |
Running with tracing enabled I suppose? |
I miscounted the number of methods. |
cc @syphar Thanks to Denis's advice. cc @GuillaumeGomez My guess is as follows. I guess in this way because:
So, it seems that the bug is more related with the number of functions of the source files rather than the size or the number of lines of the source files. In the above post, I asked as follows but nobody answered to my question:
Please anyone, who knows the answer, answer to my question, please! |
cc @GuillaumeGomez I think that I found the threshold that separates the bug zone from the normal zone. Here, the bug zone means the bug that makes the server docs.rs fail in generating the webpage of struct.BigUInt.html while the normal zone means it makes the server docs.rs succeed in generating the webpage of struct.BigUInt.html. It is relevant to the number of methods. If BigUInt has 407 or more methods, the server You can easily find it. Many Blessing to You !!! |
Thanks for this further research! While there is definitely a bug somewhere in rustdoc I still recommend that you find a way to reduce the size of the page. Event your That being said, while the method count could be the issue, it could also be the 407th method specifically that breaks doc generation here. Or the size of the docs, or the number of examples, or many other things. Also, this is using the relatively new This needs someone with more rustdoc knowledge than me to dig into. Until then I recommend trying to find ways to reduce the size of the page also locally. |
Yes, I reduced a bit in order not to fail in generating documents. Maybe I need to reduce it more. But it is a bit tricky. BigUInt is the struct that you can use to calculate (addition, subtraction, multiplication, division, power, finding prime number, etc.) big unsigned integers such as 1024-bit unsigned integers, 2048-bit, or longer integers. So, how to use it should be as easy and simple as normal integer calculation such as u64, u128, i32, etc. But if I implement such functionalities using traits and their implementation in order to scatter all the necessary methods to the outside of the struct BigUInt in order to reduce the number of functions, how to use it will be more complicated for users. That is my dilemma. By the way, how can I make cc to somebody in this kind of markdown post? Can you let me know? One day GuillaumeGomez asked me to cc to him but I couldn't because I didn't know how to do that. Thanks |
Can you provide the link to the repository so I can check what's wrong? |
in |
I'll wait for them to confirm:
|
Thank you for your digging
Yes, It is the actual repository.
I commented out some functions and published the crate to find how many functions of BigUInt cause the webserver to fail in generating the struct.BigUInt.html. I did it fifteen times changing the number of functions of BigUInt. And I found that if BigUInt has 407 methods, the server fails in generating struct.BigUInt.html while if BigUInt has 406 methods, the server succeeds in generating struct.BigUInt.html. You can see it at https://crates.io/crates/cryptocol/versions. So, I reduced the number of methods of BigUInt in order that the server can generate the webpage struct.BigUInt.html successfully. Thanks |
Do you have a branch with the bug I can use? |
Sorry, I was out of this city. That's why I couldn't get your question. And, I found that the |
Thank you for your digging it. |
something I already set, but here for clarification:
You can manually add the missing argument to your
Running Running your build with the fixed |
Adding this to the bottom of your Cargo.toml will make docs.rs generate the 8MB output instead of the 142MB output, which eliminates the failure without needing to shrink the number of methods on BigUInt. [[example]]
name = "biguint_examples"
doc-scrape-examples = false
[[example]]
name = "des_examples"
doc-scrape-examples = false
[[example]]
name = "hash_app"
doc-scrape-examples = false
[[example]]
name = "hash_examples"
doc-scrape-examples = false
[[example]]
name = "md4_app"
doc-scrape-examples = false
[[example]]
name = "md5_app"
doc-scrape-examples = false
[[example]]
name = "performance_test_biguint"
doc-scrape-examples = false
[[example]]
name = "random_examples"
doc-scrape-examples = false
[[example]]
name = "sha1_app"
doc-scrape-examples = false
[[example]]
name = "sha2_256_app"
doc-scrape-examples = false
[[example]]
name = "sha2_512_224_app"
doc-scrape-examples = false
[[example]]
name = "sha2_512_app"
doc-scrape-examples = false
[[example]]
name = "small_uint_examples"
doc-scrape-examples = false
[[example]]
name = "unions_examples"
doc-scrape-examples = false It is very verbose. Alternatively you can add this to the top of Cargo.toml (above example = [
{ name = "biguint_examples", doc-scrape-examples = false },
{ name = "des_examples", doc-scrape-examples = false },
{ name = "hash_app", doc-scrape-examples = false },
{ name = "hash_examples", doc-scrape-examples = false },
{ name = "md4_app", doc-scrape-examples = false },
{ name = "md5_app", doc-scrape-examples = false },
{ name = "performance_test_biguint", doc-scrape-examples = false },
{ name = "random_examples", doc-scrape-examples = false },
{ name = "sha1_app", doc-scrape-examples = false },
{ name = "sha2_256_app", doc-scrape-examples = false },
{ name = "sha2_512_224_app", doc-scrape-examples = false },
{ name = "sha2_512_app", doc-scrape-examples = false },
{ name = "small_uint_examples", doc-scrape-examples = false },
{ name = "unions_examples", doc-scrape-examples = false },
] |
I published my crate to crates.io, but I found the server does not generate documentation properly. My crate is cryptocol and its link is https://docs.rs/cryptocol/0.8.5/cryptocol/. However, the webpage https://docs.rs/cryptocol/0.8.5/cryptocol/number/big_uint/struct.BigUInt.html#struct.BigUInt is failed to be generated. At the site, rust-lang/docs.rs#2676 , it is recommended to toss the issue here because it is considered that the reason is related to that fact that
cargo +nightly docs
does not work properly.I tried this code:
I expected to see this happen: All the webpages will be generated properly. Especially, /home/youngho/shared/rust-target/doc/cryptocol/number/big_uint/struct.BigUInt.html should be properly generated. So, for offline test, when I execute
cargo +nightly docs
, it should generate all the webpages fine as executingcargo doc
.Instead, this happened: For offline test, when I execute
cargo +nightly docs
, it keeps running but never ends. It looks that the cargo falls into infinite loop. However, when I executecargo doc
, it generated all the webpages fine.Meta
rustc --version --verbose
:I feel it strange about why it takes so irrationally long and generates irrationally big size of file. (Somebody said that if you wait for an hour, it generates 60 MB-sized struct.BigUInt.html, but I haven't wait for that long time.) BigUInt.rs of version 0.8.4 is 2.9 MB in size while BigUInt.rs of version 0.8.5 is 4.0 MB. The change (1.1 MB) in size makes huge difference. There must be a size threshold that cargo cannot deal with files.
backtrace
The text was updated successfully, but these errors were encountered: