cloudwego/thriftgo

Feature Request: Configurable Plugin Execution Time Limits

Closed this issue · 3 comments

Is your feature request related to a problem? Please describe.

I'm trying to generate codes with cloudwego/kitex which is a plugin of thriftgo (I think you must know it well), but my IDL file is huge and it takes a long time to be processed by the kitex plugin.

As far as I know the plugin execution time is limited to 1 minute. So when the sizes of my IDL files are large enough, thriftgo won't make it but throw an error says execute plugin 'kitex' failed: signal: killed.

Describe the solution you'd like

A CLI argument that overrides the time limit. A possible solution could be found below:

thriftgo -p foo=/path/to/plugin --plugin-time-limit=1000 # plugins have to reponse in 1000s
thriftgo -p foo=/path/to/plugin --plugin-time-limit=10m  # plugins have to reponse in 10 minutes
thriftgo -p foo=/path/to/plugin --plugin-time-limit=1h   # plugins have to reponse in 1 hour
thriftgo -p foo=/path/to/plugin --plugin-time-limit=0    # explicitly remove the time limitation

When the arguments were resolved, the global variable that contains the time limit should be modified, which initially was

// MaxExecutionTime is a timeout for executing external plugins.
var MaxExecutionTime = time.Minute

Describe alternatives you've considered

Currently I haven't come up with any ideas but to split my IDL files.

Additional context

None.

Another possible solution is to entirely discard this limitation which is unnecessary at all.

A CLI argument that overrides the time limit. A possible solution could be found below:

thriftgo -p foo=/path/to/plugin --plugin-time-limit=1000 # plugins have to reponse in 1000s
thriftgo -p foo=/path/to/plugin --plugin-time-limit=10m  # plugins have to reponse in 10 minutes
thriftgo -p foo=/path/to/plugin --plugin-time-limit=1h   # plugins have to reponse in 1 hour
thriftgo -p foo=/path/to/plugin --plugin-time-limit=0    # explicitly remove the time limitation

looks like a good solution to me.

since there is no entrance to specify thriftgo global arguments in Kitex cmd, I add a related argument in Kitex tool. cloudwego/kitex#708