Comments (8)
@marcusdacoregio providing a minimal example might take w while. As written, we have two projects having identical configuration (at least to our knowlege) one showing this bug, one working fine. I'm not completely sure what might cause this; probably some parallel requests from frontend confuse the session creation (in the debug output there's three requests to the saml login when simply opening the page one time in the browser).
For the moment, using the trigger preventing a second insert works; but I'll try the customizer, which seems a cleaner solution.
Anyways, I'll get back to this case as soon possible to try providing an example.
from spring-session.
@romainlouvet have you tried the SessionRepositoryCustomizer
as mentioned?
from spring-session.
Yes, the query itself would depend on the RDBMS and your business needs, see https://docs.spring.io/spring-session/reference/3.2-SNAPSHOT/configuration/jdbc.html#customize-sql-queries
from spring-session.
Hi, @jankoh. Can you provide a minimal, reproducible sample that demonstrates the issue? Note that you can expose the PostgreSqlJdbcIndexedSessionRepositoryCustomizer
as a bean and that would customize the createSessionAttributeQuery
to update if there is a conflict on the insert.
from spring-session.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
from spring-session.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
from spring-session.
same problem for me @jankoh, Quite regularly we get a 500 with this error ... :/
did you manage to get around the problem ?
thanks
from spring-session.
@marcusdacoregio like this ?
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.session.config.SessionRepositoryCustomizer;
import org.springframework.session.jdbc.JdbcIndexedSessionRepository;
import org.springframework.session.jdbc.config.annotation.web.http.EnableJdbcHttpSession;
import org.springframework.session.jdbc.config.annotation.web.http.JdbcHttpSessionConfiguration;
@Configuration
@EnableJdbcHttpSession
public class HttpSessionConfig extends JdbcHttpSessionConfiguration {
@Bean
public PostgreSqlJdbcHttpSessionCustomizer jdbcHttpSessionCustomizer() {
return new PostgreSqlJdbcHttpSessionCustomizer();
}
public class PostgreSqlJdbcHttpSessionCustomizer
implements SessionRepositoryCustomizer<JdbcIndexedSessionRepository> {
private static final String CREATE_SESSION_ATTRIBUTE_QUERY = """
INSERT INTO %TABLE_NAME%_ATTRIBUTES (SESSION_PRIMARY_ID, ATTRIBUTE_NAME, ATTRIBUTE_BYTES)
VALUES (?, ?, ?)
ON CONFLICT (SESSION_PRIMARY_ID, ATTRIBUTE_NAME)
DO UPDATE SET ATTRIBUTE_BYTES = EXCLUDED.ATTRIBUTE_BYTES
""";
@Override
public void customize(JdbcIndexedSessionRepository sessionRepository) {
sessionRepository.setCreateSessionAttributeQuery(CREATE_SESSION_ATTRIBUTE_QUERY);
}
}
}
from spring-session.
Related Issues (20)
- Application Does Not Start When Multiple `TransactionManager` Bean Exist
- Application Does Not Start When Multiple `TransactionManager` Bean Exist
- Add JDBC to Configurations section
- Store type property no longer exists
- Setup Auto Merge Forward Dependabot Commits Workflows HOT 1
- Store type property no longer exists
- Store type property no longer exists
- expiredSessionStrategy does not get invoked when spring session expires HOT 1
- Fix failing tests
- Fix failing tests
- Fix failing tests HOT 1
- Update to Spring Security 6.3.0-M3
- An "IllegalStateException: Session was invalidated" - exception is thrown after session was already invalidated
- spring security + form login + redis session storage -> keep coming out anonymous User HOT 3
- Consider Sorted Set Expiration Policy in RedisIndexedHttpSession HOT 1
- maxInactiveInterval from JdkMongoSessionConverter is always from MongoSession HOT 3
- Upgrade to Spring Data Bom 2024.0.0-RC1
- Upgrade to MongoDB 5.0.1
- Possibility to apply the `SessionRepositoryFilter` conditionally. HOT 2
- Update to Spring Security 6.3.0-RC1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-session.