1, The execution environment is like this . A process starts , Waiting for subsequent sending rpc Information to this process , This process is based on this RPC The corresponding flow of command processing . Command execution requires multiple steps . For example, the first stage -》 The second stage -〉 The third stage ....
2, The normal execution of the command is completed , It also returned to normal results . But after a while (2s) time , process crush. Every time you die with this process RPC Logic doesn't want to do it stack upper , this stack Other records of dependencies lib The flow of the library .
3, Every time it reappears, it dies here . It's strange . Itself this stack The process will not be triggered, so why issue RPC After the command processing is completed, the crush What about , Read the code RPC There is no problem with the command processing flow .
4, Finally, it was located in the RPC In process malloc A structural variable , But in the malloc It will be done later memset operation , But the length is longer than this malloc Structural length of , So there's actually memory stepping here . So I changed it here , The program is working .
reflection ： And then I thought about it , It's been bothering me for a while , To sum up , In fact, every double line is dead in the same irrelevant stack information , That is to say, this step memory is not a random step, but a specified step , Here we can conclude that there is a place to fix fixed content memory , It's not just stepping on it . therefore memset
memcp This is a big suspicion . Here it is memset Step on fixed memory . And every step on the content is fixed . This can improve the ability of subsequent positioning problems .