[ 
https://issues.apache.org/jira/browse/TS-3821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14661847#comment-14661847
 ] 

Leif Hedstrom commented on TS-3821:
-----------------------------------

[~briang] Is there anything we can do in the core here to make this better / 
more informative to plugin writers? I'm wondering if TS-2645 is also a plugin 
bug? I know they use a lot of custom code as well over at D.

> Segmentation fault possibly due leaks in atscppapi
> --------------------------------------------------
>
>                 Key: TS-3821
>                 URL: https://issues.apache.org/jira/browse/TS-3821
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: CPP API
>            Reporter: Jiri Podhorsky
>            Assignee: Brian Geffon
>             Fix For: 6.1.0
>
>         Attachments: AlwaysCache.cc, BlockIP.cc, EditHeader.cc
>
>
> Hello,
> I'm getting segmentation faults with ATS 5.3.1, possibly when I enabled 
> plugins in atscppapi, in which are used other Plugins than GlobalPlugin 
> (TransformationPlugin, InterceptionPlugin,...)
> i'm building traffic server only with parameters:
> ./configure --prefix=/install --exec-prefix=/exec --with-user=trafficserver 
> --enable-cppapi
> I'm getting segfault:
> {noformat}
> traffic_server: Segmentation fault (Address not mapped to object [(nil)])
> traffic_server - STACK TRACE: 
> /www/trafficserver/install/bin/traffic_server(_Z19crash_logger_invokeiP7siginfoPv+0x99)[0x4c64d9]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0)[0x2afbe25d90a0]
> {noformat}
> I tried to find an Issue and found possible leak in dectructor ~Transaction() 
>  of Transaction.cc file.
> The leak is, there is added plugin by addPlugin(TransactionPlugin *);
> and according to documentation 
> [https://docs.trafficserver.apache.org/en/latest/api/classatscppapi_1_1Transaction.html#a9835e610553275d197cabfbd6d1cab7b],
>  Transaction should be responsible for cleaning.
> But nothing removes items of list state_.plugins_, where should be pointers 
> to memory allocated with new, which won't be deleted by delete state_;
> I tried to correct it with
> {noformat} 
> for (TransactionPlugin* tmp : state_->plugins_) {
>       delete tmp;
> }
> {noformat}
> But it didn't work. I'm getting similar segfault with another 
> {noformat}
> traffic_server: Segmentation fault (Invalid permissions for mapped object 
> [0x2b86141ea898])
> traffic_server - STACK TRACE: 
> /www/trafficserver/install/bin/traffic_server(_Z19crash_logger_invokeiP7siginfoPv+0x99)[0x4c64d9]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0)[0x2b85d603d0a0]
> [0x2b86141ea898]
> {noformat}
> I tried to find more deep and find the plugins should be freed by delete in 
> another class in file utils_internal.cc.
> But if this is true, I should see in debug mode message, which is printed 
> before delete:
> {noformat}
> LOG_DEBUG("Locked Mutex...Deleting transaction plugin at %p", *iter);
> {noformat}
> But I don't see such messages in log.
> I can see in error.log lot of these messages. I'm getting them at least every 
> second.
> {noformat}
> 20150805.16h37m04s [atscppapi] [Transaction.cc:343, operator()()] server 
> request already initialized
> {noformat}
> Can you help me find the issue? Thanks for help in advance.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to