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

chenglei edited comment on HBASE-26812 at 3/29/22, 1:45 PM:
------------------------------------------------------------

[~larsh],thank you very much for reply, I have write a test for master to 
verify the {{User}} problem, and I find in {{master}} the behavior is the same 
even though it create a real {{Connection}}  instead  of 
{{ShortCircuitingClusterConnection}}, that is to say, in master, if we {{scan}} 
regions in {{CP}}, when the target {{RegionServer}} receives the request , it 
executes {{scan}} as the System User, not the original client, that is because 
in master, when we invoke {{RegionCoprocessorEnvironment.createConnection}}, we 
use following code, {{UserProvider.instantiate(conf).getCurrent()}} return the 
System User, not the current RPC request {{User}}:
{code:java}
 public Connection createConnection(Configuration conf) throws IOException {
     User user = UserProvider.instantiate(conf).getCurrent();
     return ConnectionFactory.createConnection(conf, null, user);
  }
{code}

So , for the {{User}} problem in {{CP}}, the behavior is same for is 2.x and 
master, both 2.x and master create a {{Connection}} in {{CP}} as the System 
{{User}}, not the client {{User}}.

I have updated the PR.


was (Author: comnetwork):
[~larsh],thank you very much for reply, I have write a test for master to 
verify the {{User}} problem, and I find in {{master}} the behavior is the same 
even though it create a real {{Connection}}  instead  of 
{{ShortCircuitingClusterConnection}}, that is to say, in master, if we {{scan}} 
regions in {{CP}}, when the target {{RegionServer}} receives the request , it 
executes {{scan}} as the System User, not the original client, that is because 
in master, when we invoke {{RegionCoprocessorEnvironment.createConnection}},we 
use following code,{{UserProvider.instantiate(conf).getCurrent()}} return the 
System User, not the current RPC request {{User}}:
{code:java}
 public Connection createConnection(Configuration conf) throws IOException {
     User user = UserProvider.instantiate(conf).getCurrent();
     return ConnectionFactory.createConnection(conf, null, user);
  }
{code}

So , for the {{User}} problem in {{CP}}, the behavior is same for is 2.x and 
master, both 2.x and master create a {{Connection}} in {{CP}} as the System 
{{User}}, not the client {{User}}.

I have updated the PR.

> ShortCircuitingClusterConnection fails to close RegionScanners when making 
> short-circuited calls
> ------------------------------------------------------------------------------------------------
>
>                 Key: HBASE-26812
>                 URL: https://issues.apache.org/jira/browse/HBASE-26812
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 2.4.9
>            Reporter: Lars Hofhansl
>            Priority: Critical
>
> Just ran into this on the Phoenix side.
> We retrieve a Connection via 
> {{{}RegionCoprocessorEnvironment.createConnection... getTable(...){}}}. And 
> then call get on that table. The Get's key happens to be local. Now each call 
> to table.get() leaves an open StoreScanner around forever. (verified with a 
> memory profiler).
> There references are held via 
> RegionScannerImpl.storeHeap.scannersForDelayedClose. Eventially the 
> RegionServer goes into a GC of death and can only ended with kill -9.
> The reason appears to be that in this case there is no currentCall context. 
> Some time in 2.x the Rpc handler/call was made responsible for closing open 
> region scanners, but we forgot to handle {{ShortCircuitingClusterConnection}}
> It's not immediately clear how to fix this. But it does make 
> ShortCircuitingClusterConnection useless and dangerous. If you use it, you 
> *will* create a giant memory leak.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to