Skip to content

Getting out of memory Issues  #67

@Jojanyu15

Description

@Jojanyu15

Hi, I'm getting some issues when I try to fetch more than one million of rows. I'm Using Spring 3.1.2 Java 17 with webflux.
The code that I'm using to fetch a page is the following:

`
return RxJava3Adapter.flowableToFlux(database
.select(queryString)
.fetchSize(10000)
.get(resultSet -> {

                ResultSetMetaData metaData = resultSet.getMetaData();

                int columnCount = metaData.getColumnCount();

                return Flux.<Map<String, Object>>create(emitter -> {

                    try {
                        while (resultSet.next()) {
                            Map<String, Object> row = new HashMap<>();
                            for (int i = 1; i <= columnCount; i++) {
                                String columnName = metaData.getColumnName(i);
                                Object columnValue = resultSet.getObject(i);
                                row.put(columnName, columnValue);
                            }
                            emitter.next(row);
                        }
                        emitter.complete();
                    } catch (SQLException sqlException) {
                        emitter.error(sqlException);
                    }
                });
            })).flatMap(flux -> flux);`

I'm trying to figure what's wrong and why is getting this out of memory exception.
The exception that is throwing is
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "RxCachedWorkerPoolEvictor-1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions