Skip to content

[cronet_http] Potential problem when having multiple Flutter engines #1720

@HosseinYousefi

Description

@HosseinYousefi

There is an issue with the context getter of package:jni that it will crash if used again after creating a second engine: dart-lang/native#1865

This is because the second engine sets it to another context invalid for the first one. Can we check if cronet_http is susceptible to this problem? (or maybe we store the context and it won't cause a crash/cronet doesn't really need the context so it doesn't cause a crash/etc.)

If yes, then we would want to add a warning to cronet_http's readme about the fact that it's not safe to use it when using multiple flutter engines.

The problem can be solved either if we find a different way of getting the global context, which might work well at least for cronet. Or by exposing an "engine ID", so we can keep a map of contexts per Flutter engine instead of a singleton: flutter/flutter#163430

Metadata

Metadata

Assignees

Labels

package:cronet_httptype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions