-
Notifications
You must be signed in to change notification settings - Fork 187
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
Thrift bool parameter gets into unknown volo_genbool type, methods started with '_' losts underscore symbol #515
Comments
Guys, you are the best!! Thanks for such fast fix. |
There is one more issue i found - pilota-build crashes in case meet semicolon after typedef:
leads to
And after service definition:
|
Currently there is indeed a lack of handling of semicolons or commas at the end when parsing typedef or struct, thanks for discovering, we will fix it later. But I only found the typedef example using the semicolon or comma at the end, can you guide where to confirm there are similar syntaxes for other types, such as struct and service. |
Thanks very much for your report! https://thrift.apache.org/docs/idl According to the thrift idl spec, semicolon ( But I think we can also support such usage later since it's more flexible for users and I think it will not lead to confusions. For now, maybe you can just remove the semicolon and try again? |
Thanks! We just has semicolons in that places and thrift and thriftpy2 have no issues to compile it. |
Sorry to bother you again, I tried to compile our company thrift IDLs and now see other issues:
Commenting
|
Thanks very much for your report, we will investigate this asap. |
i have a feeling that semicolon could be almost on each line, especially if author is c++ guy :)
never after struct definitions (closing '}') |
The semicolon( |
Hi, sorry for the late reply, I found that the issue is because there's a Can this idl be compiled successfully in other languages such as go/cpp? |
yes, thrift c++ and rs compile it well. also thift async is good. |
let me try using thrift rs |
It could be even worse, like:
|
I've found that, in thrift-rs, they use For now, pilota doesn't support using Supporting Could you modify your idl to avoid this limitation for now? |
Thanks for your investigation. |
Still there are few erros after parsing:
I'll prepare a test IDLs for you. |
Hi, thanks very much for your quick response! We will investigate those problems asap. If so, we can try to support your usage faster. |
It's still a bit early to discuss production plans. Currently, I'm working on migrating one of our Python projects to Rust. At this stage, I’m gathering information on libraries, frameworks, usability, support, and other relevant factors. I have one implementation in place that uses an async Thrift library, and so far, it’s showing promising results. However, when I combine it with another library (async Aerospike), the Aerospike library’s performance is unexpectedly poor—even slower than Python! I haven't yet identified the root cause of this performance issue. Since I’m not yet an expert in Rust, there’s a chance I may have overlooked something in my code here. To address this, I plan to test Volo, as it’s written purely in Rust, uses more advanced techniques, and in preliminary tests, it appears to offer better performance and lower CPU usage. |
Hi, the two issues you mentioned before should be fixed now, could you please |
For the |
@PureWhiteWu Yhea, I will implement it as soon as possible. Maybe just introduce a feature to get this done? |
|
I don't think a feature is enough, because the codec part in |
Oh you need to re-install your |
Sorry, after update all looks good!! common.rs
exception TServiceException {
...
}
include "common.thrift"
service Candidates {
...
list<common.SiteId> cleanup_indices() throws (1: common.TServiceException e)
}
|
@kubroid Yep, this is also a bug of the generated template, could you manually import the Exception type in your code for now? We will try to fix this later. |
Sure, i've already did. |
Are you able to run your application without any problems now? |
Yes, its runs now. I need to implement all internal things. I have one, maybe silly question related to thrift client. At this moment i have something like this for tests: pub struct S {
pub client: volo_gen::candidates::CandidatesClient,
}
...
volo_gen::candidates::CandidatesServer::new(S {
client: {
let addr = "127.0.0.1:7070".parse::<std::net::SocketAddr>().unwrap();
volo_gen::candidates::CandidatesClientBuilder::new("service_name")
.make_codec(volo_thrift::codec::DefaultMakeCodec::framed())
.address(addr)
.build()
},
})
.run(addr)
.await
.unwrap(); but in real life Make client for each call seems expensive. What you think is a best way to handle this? Sorry, this is completely out of the scope of current issue. |
Hi, for your use case, you can implement a discover according to this doc: https://www.cloudwego.io/docs/volo/guide/discovery_lb/ Do we have a dns resolver out of box now? @Millione Feel free to raise any questions. |
@PureWhiteWu thank you for your previous assistance! I have another request regarding the following Thrift definition: void filters_changed(
1: common.SiteId site_id,
2: optional list<string> filter_names,
99: optional common.TraceParent traceparent,
) produces async fn filters_changed(
&self,
_site_id: volo_gen::common::SiteId,
_filter_names: ::std::vec::Vec<::pilota::FastStr>,
_traceparent: volo_gen::common::TraceParent,
) -> ::core::result::Result<(), ::volo_thrift::ServerError> {
::std::result::Result::Ok(Default::default())
} In this case, traceparent is treated as a non-optional value. However, we have logic that heavily relies on the presence, absence, or specific value of this parameter. Unfortunately, due to the behavior of Python (specifically ThriftPy2), required or default fields can be omitted in the protocol if they are None. This leads to some complications in our call logic, as Is it possible to implement support for optional method parameters? Perhaps this could be controlled with an additional flag in the generator to avoid interfering with the standard implementation. Thank you once again for your excellent support! |
Thanks for your feedback, you are right I think changing this to use Option is more suitable. We will implement this asap. |
Get it.
Currently I think the answer is no, using https://docs.rs/trust-dns-resolver/latest/trust_dns_resolver/ maybe helpful, and @AH-dark has mentioned that he would like to help providing something like Consul、Etcd in the future. |
Thanks @PureWhiteWu @Millione |
Reopened since there's still an issue that needs to be solved. |
@PureWhiteWu if you relay on this, maybe its better to create a separate issue for better tracking? |
@kubroid Hi, this get supported now by annotations in IDL, you can refer to cloudwego/pilota#289 to see how it works. |
@PureWhiteWu Could you please provide an update on the progress with the optional parameters issue mentioned earlier? |
Bug Report
Encountered compilation errors when trying to compile a simple Thrift IDL using the volo crate. The errors include unknown types and incorrect handling of underscored method names, which is critical for backward compatibility with existing service definitions.
Version
Platform
Crates
volo, pilota
Description
Steps to Reproduce:
Create a Sample IDL File:
Initialize a Volo Project:
Resulting directory structure:
Review Generated Code:
In src/lib.rs, observe issues such as:
Build the Project:
Decoder part from out/volo_gen.rs still has an underscore in name:
After removing
_
from IDL method definition we can see another errorThe ability to correctly parse and handle IDLs with underscored method names is crucial for maintaining compatibility with existing production services. Adjustments to Thrift IDLs for naming conventions without underscores are not feasible due to service dependencies.
If further context or any specific file changes are required, please let me know so I can assist with providing them.
The text was updated successfully, but these errors were encountered: