transactions,garbage-collection,smartcard,javacard , Javacard - power loss during garbage collection


Javacard - power loss during garbage collection

Question:

Tag: transactions,garbage-collection,smartcard,javacard

I noticed some very strange behaviour on my smartcards (NXP J2E145, J3A081, J3C145 with an Omnikey 5121 reader): A power loss right after calling JavaCard method

JCSystem.requestObjectDeletion()

can damage the card: after about 10% of such power cuts the ATR command is very slow (1000ms) and I get no response to any other APDUs (applet selection, card manager authentication etc.).

I know that the behavior of requestObjectDeletion() depends on the vendor specific implementation, so my question is quite wide and open...

Is garbage collecting processed "usually" in a single transaction?

Is there any "official" recommendation NOT to call requestObjectDeletion() in case of a possible power loss?

Do you have any similar experience with cards by NXP?

EDIT:


Answer:

Well I think it might be an implementation bug. In general, garbage collection is usually never needed and never used on smartcards. You should avoided it under any circumstances by good applet design. Because that way you never run into memory problems, which are bad for a smartcard thats installed once in its lifetime and shall be useable for the rest of its lifecycle. Garbage Collection just takes too long anyway and maybe thatswhy the card system programmer didn't expect it to happen outside a safe environment.


Related:


Java 8 Metaspace - Avoid decrease


java,garbage-collection,metaspace
I've got a short question due to Metaspace in Java 8. I know that I can set an initial size with the -XX:MetaspaceSize - Parameter. But I wonder if it's possible to configure that this value will be the minimum size. My target is to prevent Full GCs due to...

How to differentiate change transaction from actual transaction in bitcoin raw transaction template?


transactions,rpc,bitcoin
I'm trying to create my own display of the blockchain and I encounter an understanding problem. I'm using txindex=1 in bitcoin.conf to have access to non-wallet information on transactions but when I decode a rawtransaction I cannot make the difference between the change and the amount of the transaction. Here...

Exposing whether an application is undergoing GC via UDP


java,garbage-collection,jvm
The motivation behind this question is to see whether we can make a theoretical load balancer more efficient for edge-cases by first applying its regular strategy of nominating a particular node to route an HTTP request to (say, via a round robin strategy) and then "peeking" into the internal state...

Javascript - free a memorized function


javascript,garbage-collection
I must say that I do not know the right terminology, so please forgive my some mistakes. What I have is a Table with rows. The last editable column of the last row in the table is enabled with a TabKey which automatically creates a new row. function enableTab() {...

Google Analytics duplicate transaction id multiple domains


google-analytics,transactions,google-tag-manager
I am implementing Google Analytics (via GTM) on multiple ecommerce sites. I need to record transactions to the client's google analytics account as well as to our single master analytics account, which accrues data for multiple sites. I am wondering if there will be any issues sending duplicate transaction ids...

Integrity while reading from two tables: orders and order_items


database,postgresql,transactions
I'm looking for a method of achieving data integrity while reading from the database (which does not use a lot of resources, hopefully), without adding new fields into the schema. By integrity I mean the integrity between order sum in orders table and sum of order item prices: orders (id...

G1 doesn't process soft references


java,garbage-collection,g1gc,g1
Here is my simple gc test: public class Main { static class Data { public long[] l = new long[100]; } static List<SoftReference<Data>> list = new ArrayList<>(); public static void main(String[] args) { long i = 0; while (true) { list.add(new SoftReference<>(new Data())); ++i; if (i % 1000 == 0)...

hibernate rollback not working in service layer


hibernate,postgresql,transactions,junit4,spring-4
i have issue in rollback insert/update data in postgresql database, in service layer, where as in DAO layer it is working fine. My DAO junit test Code @ContextConfiguration("classpath:datasource-context-test.xml") @RunWith(SpringJUnit4ClassRunner.class) @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true) @Transactional public class SellerDAOTest { @Test @Rollback(true) public void testAddSeller() { try { SellerDO sellerDO...

JPA difference between transaction isolation and entity locking


java,database,jpa,concurrency,transactions
I have read about transaction isolation levels. It is used to prevent parallel transaction executions errors. Its quite obvious. There are also locking modes available for entities. I understand how they work. But I cant find the reason why I need locking? I have used transaction isolation levels already. Why...

Spring JavaFX @Transactional entitymanager is closed


spring,exception,javafx,transactions,transactional
i'm stuck on a Transactional Problem using Spring @Transactional with a JavaFX application, all my beans, and graphical components are managed by spring. I initialize my appusing @PostConstruct on my Controllers. In the PostConstruct, all my daos are working perfectly but when i invoke a service to save something by...

G1GC Strange behavior


java,garbage-collection,g1gc
I've decided to try G1GC on my Eclipse Mars RC3 for JavaEE developers installation, but I observed a very strange behavior: As you can see it has run almost 700 FULL GCs for the lifecycle of the application, while only 30 minor GCs. Also I noticed that that the minor...

Can RPUSH and LPUSH in Redis race?


transactions,redis,race-condition
The docs at redis.io on RPUSH and LPUSH aren't clear on whether or not these operations are still O(1) and transational when pushing multiple items. For example, if two clients perform an RPUSH to the same list with multiple items, can their items become interspersed and thus out of order?...

SQLite3 — Return Affected Rows


jdbc,sqlite3,transactions
Supposing I have a schema with a name field and an int field. I want to get one random entry where the int value is 1, set it to 0, and return the name of the entry that was changed in a transactional manner. What's the best way to do...

Downside of using transaction dispose with entity framework integration testing


entity-framework,transactions,entity-framework-6.1
I am looking for a quick way to clean my tables data doing integration tests with EF. Everyone seems to wrap a transaction around its test method and dispose the transaction after the test. That way the data is never written to the table. Things like new auto ids for...

Django transactions: managing two different transactions atomically inside the overriding of save() method


python,django,transactions
In Django 1.4 I have a code like the following: from django.db import models from django.db import transaction class MyModel(models.Model): # model definition @transaction.commit_manually def save(self, *args, **kwargs): try: super(MyModel, self).save(*args, **kwargs) do_other_things() except: transaction.rollback() raise else: transaction.commit() obj2 = MySecondModel(mymodel = self, foo = "bar") obj2.save() class MySecondModel(models.Model): myModelId...

Fragment Transactions with transition - Unique transitionNames are required


android,transactions,fragment,transition,android-transitions
I want to go from a list view to the detail view and therefore, I use following OnClickListener in my list: @Override public void onClick(View view) { Bet bet = (Bet)view.getTag(); FragmentManager fm = getActivity().getSupportFragmentManager(); BetDetailFragment f = BetDetailFragment.create(bet); String tag = f.getClass().getName(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setSharedElementReturnTransition(TransitionInflater.from(getActivity()).inflateTransition(android.R.transition.move));...

GC cleaning the object before calling onPictureTaken method


android,garbage-collection,picturecallback
I have developed an app that takes photos without previewing them to the user. My problem is that before carrying out the OnPictureTaken method, sometimes the GC cleans the object created by the method Camera.takePicture(). Therefore, when it happens, the App is not able to save that photo. Here is...

Cakephp3 transaction find query


mysql,select,transactions,cakephp-3.0
When making a transaction in cakephp3 and adding a get() query inside all works fine. But why is a find() query not performed inside the transaction? I have the following controller in cakephp3: <?php namespace App\Controller; use Cake\Core\Configure; use Cake\Network\Exception\NotFoundException; use Cake\View\Exception\MissingTemplateException; use Cake\Network\Session; use Cake\Event\Event; use Cake\Network\Http\Client; use Cake\ORM\TableRegistry;...

Ensure concurrent (money) transactions in Entity Framework?


c#,mysql,entity-framework,transactions,atomic
Assume I have an account_profile table, which has Score field that is similar to an account's money (the database type is BIGINT(20) and the EntityFramework type is long, because I don't need decimal). Now I have the following function: public long ChangeScoreAmount(int userID, long amount) { var profile = this.Entities.account_profile.First(q...

Transactions in php function or in mysql stored procedure?


php,mysql,pdo,transactions
What is better way to begin a transaction? Inside procedures or PHP functions? For example I calling MySQL procedure like this: function sendLeaguesToDb(){ $leagues = ""; try{ $this->PDO->beginTransaction(); $stmt = $this->PDO->prepare("call insupd_Leagues(:id,:name,:country,:sport_id,:his_data,:fixtures,:livescore, :numofmatches,:latestmatch)"); $leagues=$this->soccer->GetAllLeagues(); foreach($leagues as $key=>$value){ $stmt->bindParam(':id',$value->Id); $stmt->bindParam(':name',$value->Name);...

Do I need to annotate JPA actions with @Transactional in Play Framework-1.x to prevent the connection leak?


jpa,transactions,playframework-1.x,transactionmanager
As described here (relevant parts), https://www.playframework.com/documentation/1.3.x/jpa Play will automatically start the Hibernate entity manager when it finds one or more classes annotated with the @javax.persistence.Entity annotation... When the JPA entity manager is started you can get it from the application code, using the JPA helper... Play will automatically manage transactions...

Effect of setting -XX:+PerfDisableSharedMem JVM flag to false


java,garbage-collection,jvm
I was referred to this GC pause issue; it suggests setting -XX:+PerfDisableSharedMem JVM flag to false. My question is what happens when we set this flag to false,

Why JVM is designed in a way that it does not allow force Garbage Collection? [closed]


java,garbage-collection,jvm
As far as I know, we can't force for Garbage Collection in JAVA. The best we can do is to send a request by calling System.gc() or Runtime.gc(). Doing so will send request of Garbage collection to JVM but it’s not guaranteed that garbage collection will happen. So my question...

Spring 4 + JPA (Hibernate 4) + JTA transaction manager doesn't flush automatically


java,spring,hibernate,jpa,transactions
I am migrating an application from Spring 3.0.5 + JPA 2.0 to Spring 4 + JPA (Hibernate 4) I have followed the migration guide : https://github.com/spring-projects/spring-framework/wiki/Migrating-from-earlier-versions-of-the-spring-framework. The application is using a JTA transaction manager : a Jencks / GeronimoPlatformTransactionManager (because of transactions distributed on datasources and ESB). The Spring /...

why do I have to swapCursor(null) in onLoaderReset?


java,android,garbage-collection,android-loadermanager,android-loader
Android's documentation ( https://developer.android.com/guide/components/loaders.html ) says that when I use loaders to do SQL queries, I should do swapCursor(null) in onLoaderReset method: onLoaderReset This method is called when a previously created loader is being reset, thus making its data unavailable. This callback lets you find out when the data is...

Dispose/finalize pattern : disposing managed ressources


c#,garbage-collection,dispose,finalize
Let's imagine I have a class named Base with 3 attributes : class Base : IDisposable { private string _String; private Class1 classe1; private int foo; public void Dispose() { this.Dispose(true); GC.SuppressFinalize(this); } public virtual void Dispose(bool disposing) { if (disposing) { Console.WriteLine("Free Managed ressources"); //HOW TO FREE _String, class1...

Is spring transaction is only working in entering service method?


mysql,spring,transactions,spring-transactions
I have read many stackoverflow's pages about spring transaction. My spring transaction config is <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/> My service is like this. @Service public class TestServiceImpl implements TestService { @Override public void testRollback() { testRollbackSecondLevel(); } @Transactional @Override public void testRollbackSecondLevel() { // any update sql in here carCostService.testUpdate(); throw...

Wildfly - Infinispan Transactions configuration


java,transactions,ejb,wildfly,infinispan
I am using Wildfly 8.2 with its included Infinispan (6.0.2) and I am trying to cache all values from some Oracle database table in an Infispan cache. In most cases, it seems to work, but sometimes it does not. When accessing the cache.values() (which also may not be a good...

In Django, how to achieve repeatable reads for a transaction?


python,django,transactions,isolation-level,transaction-isolation
I have a function, that does multiple queries on the same dataset and I want to ensure all the queries would see exactly the same data. In terms of SQL, this means REPEATABLE READ isolation level for the databases that support it. I don't mind having higher level or even...

No evacuation failures but still FullGC in G1GC


java,garbage-collection,g1gc
I'm tuning G1GC avoiding to occur FullGC. By following this tips http://www.infoq.com/articles/tuning-tips-G1-GC , I don't see any logs like "to-space exhausted". Java HotSpot(TM) 64-Bit Server VM (24.76-b04) for linux-amd64 JRE (1.7.0_76-b13), built on Dec 18 2014 16:58:39 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8) Memory: 4k page, physical...

JVM ClassUnloadingWithConcurrentMark flag


java,garbage-collection,jvm,g1gc
I have a question about ClassUnloadingWithConcurrentMark flag since I didn't find any useful help anywhere. If we use G1GC is set to true by default (-XX:+ClassUnloadingWithConcurrentMark). If I use -XX:-ClassUnloadingWithConcurrentMark flag to turn off class unloading after G1 concurrent mark where is class unloading executed then (which phase)? I read...

Rails on create transaction


ruby-on-rails,devise,transactions
On creating a new user (in my user model) i want to create a stripe customer as well. The two actions must only be completed if they succeed together (like i don't want a customer without a user and vice versa). For this reason I figured it would be a...

Counting total objects queued for garbage collection


c#,garbage-collection
I wanted to add a small debug UI to my OpenGL game, which will be updated frequently with various debugging options/output displays. One thing I wanted was a constant counter that shows active objects in each generation of the garbage collector. I don't want names or anything, just a total...

C# MySQL Transaction commit


c#,mysql,transactions
I want to update ~50 rows. So i do it in a foreach The Code run without any errors but there are no changes in the database. public void updateItems(List<product> prdList) { MySqlTransaction tr = null; try { tr = this.con.BeginTransaction(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = con; cmd.Transaction...

Hibernate : Stale state exception


java,spring,hibernate,spring-mvc,transactions
I am working on a Spring-MVC application in which I am trying to delete an object from the database. Some days back, this error all of a sudden started, and now I am unable to delete. I checked on net, but I cannot find what am I doing wrong and...

How do I terminate a task upon object deletion? c#


c#,garbage-collection,task
Consider the following class class Melody { public Melody() { Task.Factory.StartNew(()=>play_melody_in_loop()); } } play_melody_in_loop plays melody in loop and never completes. Instances of Melody can be collected by GC when they go out of scope. If it happens, I want to stop the playback. Can I avoid implementing IDisposable?...

Why my mysql transaction is not working properly?


php,mysql,mysqli,transactions,database-connection
I've been reading and gathering information for 2 days already and I give up. I have no clue why my piece of simple code is not succeeding. I want to insert data from one form into two tables and YES I know there are exactly same problems described here and...

EjbConetxt setRollbackOnly vs ApplicationException rollback true


java,transactions,java-ee-6
I have a method which throws an application exception with rollback true. I wonder if I have to explicitly call ejbContext.setRollbackOnly() or not? The docs here says that we need not call the EjbContext's setRollbackOnly when the exception is marked as rollback=true. In my case I catch a ApplicationException whose...

Multiple transaction managers - Selecting a one at runtime - Spring


java,spring,transactions,spring-transactions
I am using Spring to configure transactions in my application. I have two transaction managers defined for two RabbitMQ servers. .... @Bean(name = "devtxManager") public PlatformTransactionManager devtxManager() { return new RabbitTransactionManager(devConnectionFactory()); } @Bean(name = "qatxManager") public PlatformTransactionManager qatxManager() { return new RabbitTransactionManager(qaConnectionFactory()); } @Bean public ConnectionFactory devConnectionFactory() { CachingConnectionFactory factory...

How GC suspends/blocks the application threads


java,garbage-collection
I understand that GC gets triggered when a new object allocation fails or System.gc() is called. Every GC algorithm suggests that as a first step the GC thread will suspend all the application threads so that they won't affect the GC activity. But I would like to understand how GC...

How to delete previous table transaction if next table transaction fails


c#,sql,asp.net,sql-server,transactions
I'm inserting some data to tables one by one. I've two tables adjustment_header and adjustment_grid. First I'll insert data to adjustment_header table then I'll insert data to adjustment_grid table. If adjustment insertion fails, previously inserted data in adjustment_header table should be delete automatically. Is there any query for this kind...

Know what objects got garbage collected


java,garbage-collection
when I look at the memory consumption of my java app I expierience a strange behavior: The application allocates 500 MB in ~10 Minutes and then the garbage collector frees the 500 MB. Then, 500 MB gets allocated and freed again, and again and again. There are no users on...

Garbage Collection invalidates FileDescriptor?


android,garbage-collection,file-descriptor
I'm opening an asset using a FileDescriptor on Android. It appears that garbage collection changes the FileDescriptor's internal descriptor to -1. Attempting to use the FileDescriptor after that throws an exception. As a sanity check, I added this code to a blank project: try{ fd = getAssets().openFd("greensleeves.wav").getFileDescriptor(); }catch(IOException e) {...

C# Memory Leak on on different machines


c#,memory-leaks,bitmap,garbage-collection
Background info I've developed a desktop application with Windows Form (C#) for scanning, previewing and saving images. The app behaviour while scanning is the following: Scan n images Get a Bitmap for each image and store it in a temporary file Show resized thumbnails as a preview Image memory management:...

Laravel 4.2 - Transaction rollback issue with multiple databases


php,laravel,pdo,transactions
I am experiencing issues in rolling back a transaction involving tables from multiple databases. The primary table rollback behaves as expected, but the child row remains, and is now orphaned. public function devUserCreateTest() { DB::beginTransaction(); try { $childUser = new ChildUser; // Exists in database B $parentUser = new User;...

G1 young GC does not free memory - to-space exhausted


java,garbage-collection
I'm using G1GC, jdk 1.7 Java HotSpot(TM) 64-Bit Server VM (24.79-b02) for linux-amd64 JRE (1.7.0_79-b15), built on Apr 10 2015 11:34:48 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8) Memory: 4k page, physical 32826020k(12590436k free), swap 33431548k(33358800k free) CommandLine flags: -XX:AutoBoxCacheMax=3000000 -XX:+DisableExplicitGC -XX:G1NewSizePercent=20 -XX:+HeapDumpOnOutOfMemoryError -XX:InitialHeapSize=10737418240 -XX:InitiatingHeapOccupancyPercent=70 -XX:MaxDirectMemorySize=1073741824 -XX:MaxGCPauseMillis=1000...

SQL Azure Connection and Transaction


transactions,sql-azure,saas
I am using SQL Azure for a Saas based asp.net application. I have avoided transactions as much as possible to prevent deadlocks for end-users. This is due to my lack of knowledge in DB Design, but I thought avoiding transaction is atleast one sure way of reducing table and row...

JVM is functioning very differently with same flags


java,garbage-collection,jvm,g1gc
I created test application (with Sheduler inside that runs every 20ms, there are reads/writes to DB) and deployed it on Glassfish server on two different PC. Both have same (copy from one PC to another) Glassfish (both have also latest JAVA version) server with following flags: -XX:+DisableExplicitGC, XX:MaxGCPauseMillis=200, -Xmx512m, -Xms512m,...

What does it mean that the D garbage collector is “not guaranteed to run the destructor for all unreferenced objects”?


garbage-collection,d,destructor,finalizer
The D documentation at http://dlang.org/class.html#destructors states that "The garbage collector is not guaranteed to run the destructor for all unreferenced objects." However I am a little contused as to what this actually means. Is this saying that a GC implementation can choose to not call destructors when it collects the...

How can I add FOR UPDATE to a cakephp3 query?


select,transactions,sql-update,cakephp-3.0,isolation-level
Is there a way to add FOR UPDATE to a find (SELECT) query in cakephp3? I found this hack: http://bakery.cakephp.org/2012/04/14/SELECT-FOR-UPDATE-hack-kind-of-ugly-but-it-works-PostgreSQL-and-MySql.html but it does not work since the limit value must contain only of a number. Another discussion on a similar topic can be found under https://github.com/cakephp/cakephp/issues/3136#event-213462937....