Skip to content

[fix] Fix UnsupportedException for NonPersistentTopic when there are EntryFilters#19811

Closed
dao-jun wants to merge 4 commits intoapache:masterfrom
dao-jun:fix/non_persistent_topic_when_set_entry_filter
Closed

[fix] Fix UnsupportedException for NonPersistentTopic when there are EntryFilters#19811
dao-jun wants to merge 4 commits intoapache:masterfrom
dao-jun:fix/non_persistent_topic_when_set_entry_filter

Conversation

@dao-jun
Copy link
Member

@dao-jun dao-jun commented Mar 14, 2023

Motivation

In NonPersistentTopic, we dispatch messages to Consumers by using

               subscription.getDispatcher().sendMessages(Collections.singletonList(entry));

but Collections.SingleList.class didn't override void set(int i, T element) method,
it extends void set(int i, T element) from AbstractList, and AbstractList.set(int i, T element)
throws UnsupportedException.

So the following usage will lead to UnsupportedException:

List<Object> objs = Collections.singletonList(new Object());
objs.set(0, null);

But in AbstractBaseDispatcher#filterEntriesForConsumer, if the filter result is REJECT/RESCHEDULE, it will filter out the entry by calling

entries.set(i, null);

and it will throw UnsupportedException, the exception will caught by ServerCnx#exceptionCaught.

The producer will be closed and try to reconnect.

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: dao-jun#3

@github-actions
Copy link

The pr had no activity for 30 days, mark with Stale label.

@github-actions github-actions bot added the Stale label Apr 16, 2023
@Technoboy-
Copy link
Contributor

Fixed by #20141

@Technoboy- Technoboy- closed this May 24, 2023
@dao-jun dao-jun deleted the fix/non_persistent_topic_when_set_entry_filter branch May 3, 2024 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs ready-to-test Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants