Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Unhandled Promise Rejection: RangeError: Maximum call stack size exceeded. #441

Open
hut36 opened this issue Dec 12, 2024 · 3 comments

Comments

@hut36
Copy link

hut36 commented Dec 12, 2024

Description

Calling powersync.execute() will result in error "Unhandled Promise Rejection: RangeError: Maximum call stack size exceeded.". This is observed only on MacOS 15.2 (and 15.2 beta) and Safari.

Reproduction

  1. Change the code of index.js of powersync-ja/demos/example-vite as below.
  2. pnpm i && pnpm dev
  3. visit localhost:5173 using Safari, open console and you will see the error after some time.
import { column, Schema, Table, PowerSyncDatabase } from '@powersync/web';
import Logger from 'js-logger';

Logger.useDefaults();

/**
 * A placeholder connector which doesn't do anything.
 * This is just used to verify that the sync workers can be loaded
 * when connecting.
 */
class DummyConnector {
	async fetchCredentials() {
		return {
			endpoint: '',
			token: ''
		};
	}

	async uploadData(database) {}
}

const customers = new Table({ name: column.text })
export const AppSchema = new Schema({ customers });

let PowerSync;

const openDatabase = async () => {
	PowerSync = new PowerSyncDatabase({
		schema: AppSchema,
		database: { dbFilename: 'test.sqlite' }
	});

	await PowerSync.init();
	//await PowerSync.connect(new DummyConnector());
};

document.addEventListener('DOMContentLoaded', async (event) => {
	await openDatabase();

	let name = 0;
	while (name < 10000) {
		console.log('name: ', name);
		await PowerSync.execute('INSERT INTO customers(id, name) VALUES(uuid(), ?)', [`${name}`]);
		name += 1;
	}
});

Additional Info

Platform: MacOS 15.2 x86_64
@powersync/web: 1.12.1

@Chriztiaan
Copy link
Contributor

Chriztiaan commented Dec 12, 2024

Hey @hut36, do you have discord available? A possible fix has been discussed here alongside a dev release. We are working on an official version of this release that addresses this problem formally.

I haven't tested this specific demo with the dev release, but I can check it.

@Chriztiaan
Copy link
Contributor

Just an update @hut36, I was able to reproduce the issue with your code against the latest Safari.
I can also confirm that with the dev release using either WASQLiteVFS.OPFSCoopSyncVFS or WASQLiteVFS.AccessHandlePoolVFS the issue is fixed. Will follow up when it is released.

@hut36
Copy link
Author

hut36 commented Dec 13, 2024

Thanks for the quick reply! The userWebWorker: false apporach works for me. Looking forward to the OPFS VFS being released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants