Repository: apache/rocketmq

Issue #3887: fail to validate after update acl
Created: 2022-02-24T15:49:38Z
BUG REPORT

Please describe the issue you observed:


What did you do (The steps to reproduce)?


call updateAccessConfig to update acl
do acl validation using the new acl



What did you expect to see?


What did you see instead?
see the error:


java.lang.NullPointerException
	at org.apache.rocketmq.acl.plain.PlainPermissionManager.validate(PlainPermissionManager.java:646)
	at org.apache.rocketmq.acl.plain.PlainAccessValidator.validate(PlainAccessValidator.java:141)
	at org.apache.rocketmq.acl.plain.PlainAccessValidatorTest.testValidateAfterUpdateAccessConfig(PlainAccessValidatorTest.java:942)



Please tell us about your environment:


Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
after update acl, the file watcher will call load() function, the plainAccessResourceMap will not put new acl because the condition this.accessKeyTable.get(plainAccessResource.getAccessKey()) is not null


                if (this.accessKeyTable.get(plainAccessResource.getAccessKey()) == null) {
                    plainAccessResourceMap.put(plainAccessResource.getAccessKey(), plainAccessResource);
                    this.accessKeyTable.put(plainAccessResource.getAccessKey(), aclFilePath);
                }

Duplicate issue #4025: acl not work after changed
Created: 2022-03-23T14:48:33Z
The issue tracker is used for bug reporting purposes ONLY whereas feature request needs to follow the RIP process. To avoid unnecessary duplication, please check whether there is a previous issue before filing a new one.
It is recommended to start a discussion thread in the mailing lists in cases of discussing your deployment plan, API clarification, and other non-bug-reporting issues.
We welcome any friendly suggestions, bug fixes, collaboration, and other improvements.
Please ensure that your bug report is clear and self-contained. Otherwise, it would take additional rounds of communication, thus more time, to understand the problem itself.
Generally, fixing an issue goes through the following steps:

Understand the issue reported;
Reproduce the unexpected behavior locally;
Perform root cause analysis to identify the underlying problem;
Create test cases to cover the identified problem;
Work out a solution to rectify the behavior and make the newly created test cases pass;
Make a pull request and go through peer review;

As a result, it would be very helpful yet challenging if you could provide an isolated project reproducing your reported issue. Anyway, please ensure your issue report is informative enough for the community to pick up. At a minimum, include the following hints:
BUG REPORT
1. Please describe the issue you observed:

What did you do (The steps to reproduce)?

build from 4.9.3 source codes
enable acl and deploy with 1 namesrv, 1 broker ( use default acl files)
produce message with ak=RocketMQ, sk=12345678 , send messages to topic topicB
send ok
update ACL for topicB using ./mqadmin updateAclConfig -c rocketmq-cluster-1 -a RocketMQ -s 12345678 -t 'topicB=DENY' -n 127.0.0.1:9876
produce message again, send fail. we expect this.
update ACL for topicB using ./mqadmin updateAclConfig -c rocketmq-cluster-1 -a RocketMQ -s 12345678 -t 'topicB=PUB|SUB' -n 127.0.0.1:9876, error would come out


RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.InternalThreadLocalMap).
RocketMQLog:WARN Please initialize the logger system properly.
org.apache.rocketmq.tools.command.SubCommandException: UpdateAccessConfigSubCommand command failed
at org.apache.rocketmq.tools.command.acl.UpdateAccessConfigSubCommand.execute(UpdateAccessConfigSubCommand.java:180)
at org.apache.rocketmq.tools.command.MQAdminStartup.main0(MQAdminStartup.java:146)
at org.apache.rocketmq.tools.command.MQAdminStartup.main(MQAdminStartup.java:97)
Caused by: org.apache.rocketmq.client.exception.MQClientException: CODE: 1  DESC: java.lang.NullPointerException, org.apache.rocketmq.acl.plain.PlainPermissionManager.validate(PlainPermissionManager.java:648)
For more information, please visit the url, http://rocketmq.apache.org/docs/faq/
at org.apache.rocketmq.client.impl.MQClientAPIImpl.createPlainAccessConfig(MQClientAPIImpl.java:328)
at org.apache.rocketmq.tools.admin.DefaultMQAdminExtImpl.createAndUpdatePlainAccessConfig(DefaultMQAdminExtImpl.java:205)
at org.apache.rocketmq.tools.admin.DefaultMQAdminExt.createAndUpdatePlainAccessConfig(DefaultMQAdminExt.java:175)
at org.apache.rocketmq.tools.command.acl.UpdateAccessConfigSubCommand.execute(UpdateAccessConfigSubCommand.java:170)
... 2 more



What is expected to see?
acl changed success
What did you see instead?
exception comes
Please tell us about your environment:
RocketMQ 4.9.3
mac os M1

Other information (e.g. detailed explanation, logs, related issues, suggestions on how to fix, etc):

FEATURE REQUEST


Please describe the feature you are requesting.


Provide any additional detail on your proposed use case for this feature.


Indicate the importance of this issue to you (blocker, must-have, should-have, nice-to-have). Are you currently using any workarounds to address this issue?


If there are some sub-tasks involved, use -[] for each sub-task and create a corresponding issue to map to the sub-task:



sub-task1-issue-number: sub-task1 description here,
sub-task2-issue-number: sub-task2 description here,
...

Closing comment (2022-03-23T15:00:24Z): is it the same as #3887 ?