rapscallion icon indicating copy to clipboard operation
rapscallion copied to clipboard

promise-based rendering. sometimes hangs

Open indeyets opened this issue 8 years ago • 9 comments

I use promise based rendering in a project. Server is build using webpack

Sometimes, while in development mode, I see that rapscallion's promise just never returns. It usually happens when code was just recently build and nodemon started the process. Killing server and starting it manually (without auto-rebuild) usually solves the issue.

I didn't notice this behavior before the update of rapscallion. I see it all the time in my dev-cycle right now (Production env works just fine, but it runs on pre-built code).

UPDATE: figured out the trigger. NODE_ENV=development causes the hang

indeyets avatar Jun 30 '17 12:06 indeyets

@fleg any ideas what could cause this? error handling maybe?

indeyets avatar Jun 30 '17 12:06 indeyets

ok, it actually returns, but it takes several minutes. The server is in a blocked state during this period.

indeyets avatar Jun 30 '17 12:06 indeyets

figured out the trigger. it's NODE_ENV=development. it works fine with other values

indeyets avatar Jun 30 '17 14:06 indeyets

This is new in >= 2.1.8?

88kami88 avatar Jun 30 '17 15:06 88kami88

Yup. I didn't see it happening before. Might be coincidence of course. I will recheck with older version later today

indeyets avatar Jun 30 '17 16:06 indeyets

I think it's possible #106 would manifest this way for promises.

88kami88 avatar Jul 03 '17 19:07 88kami88

Hi guys, Maybe it's related, but the bellow code give this warning:

(node:25231) Warning: a promise was created in a handler at node_modules/rapscallion/lib/consumers/node-stream.js:42:9 but was not returned from it, see http://goo.gl/rRqMUw

[1]  at Function.Promise.cast (/node_modules/rapscallion/node_modules/bluebird/js/release/promise.js:196:13)

code:

export async function getMainComponentStream(MainComponent: any): any {
  const componentRenderer = await render(MainComponent);
  const templateRenderer = await template`<!doctype html>${componentRenderer}`;
  const componentStream = await templateRenderer.toStream();
  return componentStream;
}

Any ideas?

liviuignat avatar Jul 12 '17 07:07 liviuignat

@indeyets Is this fixed in 2.1.13 by chance?

88kami88 avatar Aug 02 '17 03:08 88kami88

@ethersage it isn't. still happens here

indeyets avatar Aug 02 '17 04:08 indeyets