Skip to content

Commit

Permalink
Try to reproduce #1708 with a unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Jun 13, 2024
1 parent 510a4fa commit fc08b8a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/realm_dart/src/realm-core
Submodule realm-core updated 93 files
+4 −0 .github/workflows/make-release.yml
+3 −1 .github/workflows/prepare-release.yml
+1 −1 .gitignore
+30 −0 CHANGELOG.md
+1 −2 Package.swift
+1 −1 dependencies.yml
+68 −1 evergreen/config.yml
+5 −1 src/external/bson/CMakeLists.txt
+14 −22 src/realm/alloc.cpp
+18 −37 src/realm/alloc.hpp
+31 −80 src/realm/alloc_slab.cpp
+3 −15 src/realm/alloc_slab.hpp
+4 −0 src/realm/array.hpp
+8 −4 src/realm/array_integer_tpl.hpp
+21 −20 src/realm/db.cpp
+2 −7 src/realm/db.hpp
+3 −3 src/realm/exec/realm_decrypt.cpp
+38 −25 src/realm/exec/realm_trawler.cpp
+0 −4 src/realm/group.cpp
+3 −3 src/realm/group_writer.cpp
+3 −0 src/realm/group_writer.hpp
+0 −1 src/realm/node_header.hpp
+1 −1 src/realm/object-store/impl/realm_coordinator.cpp
+1 −1 src/realm/object-store/impl/realm_coordinator.hpp
+15 −13 src/realm/object-store/sync/sync_session.cpp
+1 −1 src/realm/object-store/sync/sync_session.hpp
+1 −5 src/realm/query_engine.hpp
+97 −68 src/realm/replication.cpp
+59 −76 src/realm/replication.hpp
+5 −0 src/realm/sync/client.cpp
+1 −0 src/realm/sync/config.hpp
+15 −5 src/realm/sync/noinst/client_impl_base.cpp
+2 −0 src/realm/sync/noinst/client_impl_base.hpp
+43 −32 src/realm/sync/noinst/client_reset.cpp
+1 −1 src/realm/sync/noinst/pending_bootstrap_store.cpp
+0 −33 src/realm/sync/noinst/server/access_token.cpp
+0 −1 src/realm/sync/noinst/server/server.cpp
+0 −1 src/realm/sync/tools/print_changeset.cpp
+3 −11 src/realm/table.cpp
+0 −3 src/realm/table.hpp
+1 −1 src/realm/tokenizer.cpp
+0 −3 src/realm/transaction.cpp
+35 −44 src/realm/util/aes_cryptor.hpp
+670 −707 src/realm/util/encrypted_file_mapping.cpp
+98 −118 src/realm/util/encrypted_file_mapping.hpp
+206 −361 src/realm/util/file.cpp
+81 −245 src/realm/util/file.hpp
+92 −751 src/realm/util/file_mapper.cpp
+21 −131 src/realm/util/file_mapper.hpp
+1 −10 src/realm/util/load_file.cpp
+0 −1 src/realm/util/load_file.hpp
+32 −32 src/realm/util/safe_int_ops.hpp
+6 −10 src/realm/utilities.hpp
+1 −0 test/benchmark-larger/main.cpp
+1 −0 test/fuzz_group.cpp
+4 −4 test/object-store/sync/client_reset.cpp
+33 −7 test/object-store/sync/flx_migration.cpp
+6 −6 test/object-store/sync/flx_schema_migration.cpp
+6 −4 test/object-store/sync/flx_sync.cpp
+1 −1 test/object-store/sync/metadata.cpp
+1 −3 test/object-store/sync/sync_manager.cpp
+1 −0 test/object-store/thread_safe_reference.cpp
+1 −4 test/object-store/transaction_log_parsing.cpp
+2 −2 test/object-store/util/sync/baas_admin_api.cpp
+2 −2 test/object-store/util/test_utils.hpp
+5 −1 test/realm-fuzzer/fuzz_configurator.cpp
+4 −1 test/realm-fuzzer/fuzz_configurator.hpp
+8 −11 test/realm-fuzzer/fuzz_engine.cpp
+0 −27 test/stitch_private.pem
+0 −9 test/stitch_public.pem
+0 −15 test/test_all.cpp
+2 −7 test/test_alloc.cpp
+6 −5 test/test_client_reset.cpp
+1 −0 test/test_compaction.cpp
+462 −228 test/test_encrypted_file_mapping.cpp
+122 −186 test/test_file.cpp
+2 −2 test/test_group.cpp
+1 −1 test/test_json.cpp
+5 −4 test/test_query.cpp
+333 −0 test/test_replication.cpp
+8 −13 test/test_shared.cpp
+0 −34 test/test_sync_auth.cpp
+0 −121 test/test_table_helper.hpp
+0 −178 test/test_transactions.cpp
+22 −21 test/test_transform.cpp
+2 −2 test/test_upgrade_database.cpp
+2 −2 test/test_util_logger.cpp
+0 −9 test/tsan.suppress
+1 −0 test/util/spawned_process.cpp
+1 −1 test/util/test_path.cpp
+6 −2 test/util/test_path.hpp
+19 −4 tools/release-init.sh
+1 −0 tools/run-in-simulator.sh
16 changes: 16 additions & 0 deletions packages/realm_dart/test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:crypto/crypto.dart';
import 'package:http/http.dart';
import 'package:path/path.dart' as path;
import 'package:realm_dart/realm.dart';
import 'package:realm_dart/src/configuration.dart';
import 'package:realm_dart/src/handles/realm_core.dart';

import 'test.dart';
Expand Down Expand Up @@ -379,6 +380,21 @@ void main() {
expect(log, contains('App constructor called on Isolate'));
});

baasTest('boom', (appConfig) async {
final appId = appConfig.appId;
final url = appConfig.baseUrl;
for (var i = 0; i < 100; i++) {
await Isolate.run(() async {
clearCachedApps(); // simulate first time on main isolate
final app = App(AppConfiguration(appId, baseUrl: url));
final user = await app.logIn(Credentials.anonymous());
final config = Configuration.flexibleSync(user, getSyncSchema());
final realm = getRealm(config, stopPolicy: SessionStopPolicy.afterChangesUploaded);
realm.close();
});
}
});

test('AppConfiguration(empty-id) throws', () {
expect(() => AppConfiguration(''), throwsA(isA<RealmException>()));
});
Expand Down
4 changes: 2 additions & 2 deletions packages/realm_dart/test/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,9 @@ String generateRandomEmail({int length = 5}) {
return "$randomString@realm.io";
}

Realm getRealm(Configuration config) {
Realm getRealm(Configuration config, {SessionStopPolicy stopPolicy = SessionStopPolicy.immediately}) {
if (config is FlexibleSyncConfiguration) {
config.sessionStopPolicy = SessionStopPolicy.immediately;
config.sessionStopPolicy = stopPolicy;
}

final realm = Realm(config);
Expand Down

0 comments on commit fc08b8a

Please sign in to comment.