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

Generate error, Argument list too long. #633

Closed
o2e opened this issue Oct 30, 2022 · 13 comments
Closed

Generate error, Argument list too long. #633

o2e opened this issue Oct 30, 2022 · 13 comments
Milestone

Comments

@o2e
Copy link

o2e commented Oct 30, 2022

I have a huge project that contains 14,982 proto files and I get an "Argument list too long" error when I compile it. Is there any way to deal with it. I can't split this project at the moment, please help me or give me a suggestion. Thank you!

Execution failed for task ':generateProto'.
> java.io.IOException: Cannot run program "/Users/Smile/.gradle/caches/modules-2/files-2.1/com.google.protobuf/protoc/3.21.9/b5370f325a89e44a469213e65689c341f7d2a183/protoc-3.21.9-osx-x86_64.exe": error=7, Argument list too long
@rougsig
Copy link
Collaborator

rougsig commented Oct 30, 2022

Hello. Could you please provide a bit more details.

1 plugin version
2 used plugins
3 Windows version

@rougsig
Copy link
Collaborator

rougsig commented Oct 30, 2022

Also we have special logic for splitting long commands. Maybe sources can help to understand, what is going wrong.

https:/google/protobuf-gradle-plugin/blob/master/src/main/groovy/com/google/protobuf/gradle/GenerateProtoTask.groovy#L178

It would be perfect if you can provide reproducible project.

@o2e
Copy link
Author

o2e commented Oct 31, 2022

I use the "protocol buffers(222.4345.14)" plugin bundled with idea,
gradle plugin: "id("com.google.protobuf") version "0.9.1","
protoc version: "com.google.protobuf:protoc:3.21.9""
System version: MacOS X 10.15.7

Can't provide the project, but I can help to verify some ideas. project's proto file file is very very large, about 5MB in total. So far I have guessed to divide into several projects and compile them successfully. I think I can write code to generate many random proto files and try to reproduce them.

@rougsig
Copy link
Collaborator

rougsig commented Oct 31, 2022

Could you please write absolute path size to your proto dir? Like /Users/Smile/projects/myProject/app/src/main/proto -> 50

@o2e
Copy link
Author

o2e commented Nov 1, 2022

I don't quite understand what I should do, can you be more specific? Please excuse the slow response as I cannot access the external network recently.

Could you please write absolute path size to your proto dir? Like /Users/Smile/projects/myProject/app/src/main/proto -> 50

@rougsig
Copy link
Collaborator

rougsig commented Nov 1, 2022

Your proto files placed in some directory. In argument in cli, plugin pass <PATH_TO_PROTO_FILE>/myMessage.proto. I want to known the length of PATH_TO_PROTO_FILE. Just to calculate how much approximately you have the length of the argument.

@karthikrg
Copy link
Contributor

@rougsig My invocation is ~1.7MB long. It is a legacy project which I am converting from another IDL to proto with tight interdependencies between schemas, so it is kinda hard to split it up into multiple protoc invocations.

@karthikrg
Copy link
Contributor

The cleaner solution actually seems to be to support the @filename option of protoc and append all args to the file. This would be similar to the approach adopted by the maven plugin in xolstice/protobuf-maven-plugin#42 .

@rougsig would you be open to an intermediary hardcoded solution as proposed in #653 fast followed by a clean solution using @filename?

@rougsig
Copy link
Collaborator

rougsig commented Jan 7, 2023

@karthikrg Hardcoded solution is fine.

@o2e
Copy link
Author

o2e commented Jan 7, 2023

Have you guys reproduced the problem yet? I'm sorry I haven't been able to help you guys out because of the long time without internet, and in fact I don't have the time right now.

I think your idea of making a txt file with the paths of all .proto files to pass to the protoc program seems good. The list of .proto files could be automatically generated by gradle-plugin, split by newlines and written to a txt file. The logic wouldn't be much to change, just collect all the .proto files according to the original logic, except that it might require support from the protoc program

@rougsig
Copy link
Collaborator

rougsig commented Jan 7, 2023

@o2e yeah it will works too. Actually we already have splitting logic for Windows. For other OS it was disabled. Changes from @karthikrg enable that splitting.

@o2e
Copy link
Author

o2e commented Jan 7, 2023

👍

@ejona86 ejona86 added this to the 0.9.2 milestone Jan 8, 2023
@ejona86
Copy link
Collaborator

ejona86 commented Jan 8, 2023

This should be fixed by #653

@ejona86 ejona86 closed this as completed Jan 8, 2023
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

4 participants