camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zemian Deng (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-6561) Inserting JSON like data with sql component cause a java.lang.StackOverflowError
Date Fri, 19 Jul 2013 02:42:50 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-6561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13713284#comment-13713284
] 

Zemian Deng commented on CAMEL-6561:
------------------------------------

Hi,

I see where the problem is now. Since I send input message as plain String, the "sql" component
automatically converts it to Iterator type for SQL parameters bindings. What's hidden is that
default converter will also use a delimiter to parse the string! (I see this in ObjectHelper.java
line 601, which uses a RegExp that happens to cause StackOverflowError with the input I give.

I can work around this by actually just send an Iterator type (List<String>) as message
type instead of String. It then works as intended and not get the StackOverflowError problem.
I should have done this in first place anyway since my input is large and not typical.

If you guys don't see this as problem to fix or improve, then please close it.

Thanks,
Zemian Deng
                
> Inserting JSON like data with sql component cause a java.lang.StackOverflowError
> --------------------------------------------------------------------------------
>
>                 Key: CAMEL-6561
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6561
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>    Affects Versions: 2.11.0
>            Reporter: Zemian Deng
>         Attachments: sample1.json
>
>
> I have a simple route use case like this:
> {code}
> <camel:camelContext id="camel-server" xmlns="http://camel.apache.org/schema/spring">
> 		<template id="producerTemplate"/>
>         <route>
> 			<from uri="direct:SEND_MEMQ"/>
> 			<to uri="sql:INSERT INTO CAMEL_TEST(MSG) VALUES(#)?dataSource=testdbDataSource"/>
> 			<to uri="log:camel.demos.throughputtest.tcp.Stat?level=INFO&amp;groupSize=100"/>
>         </route>
>     </camel:camelContext>
> {code}
> The DB table is simple one like this:
> {code}
> /* H2Database */
> DROP TABLE CAMEL_TEST;
> CREATE TABLE CAMEL_TEST ( 
>   ID BIGINT PRIMARY KEY AUTO_INCREMENT,
>   MSG VARCHAR(10240),
>   CREATE_TS TIMESTAMP DEFAULT NOW()
> );
> {code}
> And then I use the producerTemplate to send a sample JSON content like data message (see
attachment) into the "direct:SEND_MEMQ" (I read the full file and send it as String), and
it produced the following severe error:
> {code}
> 2013-07-18 08:34:00,593 ERROR pool-1-thread-1 [org.apache.camel.processor.DefaultErrorHandler]
- Failed delivery for (MessageId: ID-L328BDS002012US-56371-1374150839469-0-1 on ExchangeId:
ID-L328BDS002012US-56371-1374150839469-0-2). Exhausted after delivery attempt: 1 caught: org.apache.camel.CamelExecutionException:
Exception occurred during execution on the exchange: Exchange[Message: {"web-app": {
> ... 
> ... [Body clipped after 1000 chars, total length is 3467]]
>         at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1354)
>         at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:272)
>         at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:64)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
>         at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
>         at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.processor.interceptor.BacklogTracerInterceptor.process(BacklogTracerInterceptor.java:84)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:390)
>         at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:273)
>         at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:335)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:117)
>         at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
>         at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:122)
>         at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:60)
>         at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
>         at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
>         at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>         at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
>         at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63)
>         at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:366)
>         at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:337)
>         at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:233)
>         at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:337)
>         at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:175)
>         at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:111)
>         at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:124)
>         at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:131)
>         at throughputtest.FileSampleProducer$1.run(FileSampleProducer.java:64)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>         at java.lang.Thread.run(Thread.java:662)
> Caused by: java.lang.StackOverflowError
>         at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
>         at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
>         at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
>         at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078)
>         at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)
>         at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
>         at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
>         at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
>         at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
>         at java.util.regex.Pattern$BranchConn.match(Pattern.java:4078)
>         at java.util.regex.Pattern$CharProperty.match(Pattern.java:3345)
>         at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
>         at java.util.regex.Pattern$GroupHead.match(Pattern.java:4168)
>         at java.util.regex.Pattern$Loop.match(Pattern.java:4295)
>         at java.util.regex.Pattern$GroupTail.match(Pattern.java:4227)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message