@@ -671,12 +671,22 @@ int flb_pack_json(const char *js, size_t len, char **buffer, size_t *size,
671671#ifdef FLB_HAVE_SIMD
672672 /*
673673 * When SIMD support is compiled in, route the default JSON pack API through
674- * the extensible frontend so callers inherit the YYJSON backend selection.
674+ * the extensible frontend so callers inherit the YYJSON backend
675+ * selection.
676+ * However, all of the defaulting to use YYSJON is dangerous on
677+ * coroutine.
678+ * So, we only enabled it for normal thread.
679+ * Still, we use legacy backend on using coroutine.
675680 * Explicit backend-specific entry points remain available for forced JSMN
676681 * or YYJSON behavior.
677682 */
678- return flb_pack_json_recs_ext (js , len , buffer , size , root_type ,
679- & records , consumed , NULL );
683+ if (flb_coro_get () != NULL ) {
684+ return flb_pack_json_legacy (js , len , buffer , size , root_type , consumed );
685+ }
686+ else {
687+ return flb_pack_json_recs_ext (js , len , buffer , size , root_type ,
688+ & records , consumed , NULL );
689+ }
680690#endif
681691
682692 return flb_pack_json_legacy (js , len , buffer , size , root_type , consumed );
0 commit comments