Does Using Opaque Access Tokens Make My Server Stateful?

I am trying to understand statelessness in restful APIs in the context of authentication. Here’s the scenario:

  1. The user logs in.
  2. The server verifies the username and the password, and generates an opaque access token. It caches some information related to this token – for example, the expiration time, the userId, whether this token was explicitly invalidated before it expired, etc.
  3. The token is sent to the client, and the client sends it with every future request.

Fielding’s dissertation defines statelessness as:

“…such that each request from client to server must contain all of the information necessary to understand the request, and cannot take advantage of any stored context on the server. Session state is therefore kept entirely on the client.”

In my example, the client is sending the token with every request, so the first condition is satisfied. However, my server has a context associated with this session that is stored in the sessions cache.

Does this make my application stateful?

If yes, then is it that true statelessness be achieved only if we are using JWTs? I am pondering upon this as JWTs are quite new, so how were architects building truly stateless services before they were invented?

Stateful Scripts in Automator?

Is there a way to run stateful bash scripts in automator?

I’m trying to run something depending if a file does or does not exist. With bash script alone in terminal the code below works and will show the correct output, depending on wether the file exists or not.

Only one line of output per run of the script is displayed either way.

FILE="/Volumes/Canvio1TB/EyeTV Archive/sync.ffs_lock" if test -f "$  FILE"; then     echo "$  FILE exists" else   echo "$  FILE does not exist" fi 

When I run this in automator as a “run shell script” action the output is:

/Volumes/Canvio1TB/EyeTV Archive/sync.ffs_lock exists

/Volumes/Canvio1TB/EyeTV Archive/sync.ffs_lock does not exist

Regardless of wether the file exists or not, the script generates both lines of output.


If there’s a better approach I’d be open to using it – I haven’t had success with the syntax of applescript running a command based on the (non)existence of a full path & file.

Stateful detection in Snort

From whatever I have read of Snort, it can analyse a single packet at a time and raise an alert based on its rules.

What if I wish to have a rule based on multiple packets such as analysis of a protocol situation that can maintain its states, e.g. TCP or TLS?

Stateful detection in Snort

From whatever I have read of Snort, it can analyse a single packet at a time and raise an alert based on its rules.

What if I wish to have a rule based on multiple packets such as analysis of a protocol situation that can maintain its states, e.g. TCP or TLS?

Session Stickiness in a Stateful Microservice

I have created a simple Spring Boot Microservice for a game of Rock Paper Scissors. It involves in memory storage of registered players as well as the rounds that they play. Now, if I have to use it with a frontend in a scalable cloud environment I am going to require session stickiness. There are unique ids to players as well as the session that the two opponents play with. How can I ensure session stickiness when I have multiple instances of this microservice running in my cluster ?

Stateful vs non-stateful app

I have been learning about stateful apps vs non-stateful, but I am still a bit confused on this topic.

For example, let’s say I have an app running on Node where users are assigned to random rooms as soon as they connect through These are rooms of 4 and not persistent in any way, but they are stored in a global variable as a hash map. I am not using a db (too many queries) nor redis (it’s too expensive).

Is this an example of a stateful app or not?

Strategy to deal with stateful applications in clusters

I have an app in which users are assigned to rooms. These rooms are saved server-side. In the beginning I was using a single instance so the rooms could be saved in-memory.

But now as I want to scale this is not a viable solution. Using databases seems like a very slow option, as the entries are too many and too fast to handle.

I have looked into memcached, but I read that it’s not reliable in a shared cloud environment (if the table is full it starts re-writing values).

How can I handle a situation such as this?

Difference(s) between an ACL and a Layer 4 (Stateful) Firewall

Please can someone explain the primary difference(s) between an ACL and a Layer 4 (Stateful) Firewall? I’m looking for a basic explanation if possible as I want to build my foundation knowledge.

I understand that an ACL (deny/allow) operates on a router/layer 3 switch and that a firewall can aswell, or as a standalone device, but that’s about it!


How to increase disk size in a stateful set

I’m managing an Elasticsearch deployment in Kubernetes. I see that the disk storage is getting close to full, so I would like to increase the size of the persistent volumes.

I want to change this value in the Stateful Set:

volumeClaimTemplates[0] : "10Gi"

But when I do this using the Kubernetes-dashboard, I get the following message:

Internal server error

StatefulSet.apps “es-cluster” is invalid: spec: Forbidden: updates to statefulset > spec for fields other than ‘replicas’, ‘template’, and ‘updateStrategy’ are forbidden.

This makes me think that I will have to delete my existing Stateful Set and deploy a new one.

Is it possible to increase the per-pod disk storage without a service interruption or loss of data?

Better way of access the stateful variables objects in the given class hierarchy

I asked this question already at stackoverflow together with a serialization related part. Since the design related part receives no answers or comments I’d like to have a review on this here.

The problem: I have a complicated class hierarchy in which the classes are similar to each other but every class contains a bunch of more or less complicated stateful variables. To give you an impression, please have a look at this minimal working example:

class OptVar:     """     Complicated stateful variable     """     def __init__(self, name="", **kwargs): = name         self.parameters = kwargs   class OptVarContainer:     """     Class which contains several OptVar objects and nested OptVarContainer     classes. Is responsible for OptVar management of its sub-OptVarContainers     with their respective OptVar objects.     """     def __init__(self, name="", **kwargs): = name         for (key, value_dict) in kwargs.items():             setattr(self, key, OptVar(name=key, **value_dict))      def getAllOptVars(self):          def addOptVarToDict(var,                             dictOfOptVars={},                             idlist=[],                             reducedkeystring=""):             """             Accumulates optimizable variables in var and its linked objects.             Ignores ring-links and double links.              @param var: object to evaluate (object)             @param dictOfOptVars: optimizable variables found so far (dict of dict of objects)             @param idlist: ids of objects already evaluated (list of int)             @param reducedkeystring: to generate the dict key (string)             """              if id(var) not in idlist:                 idlist.append(id(var))                  if isinstance(var, OptVarContainer):                     for (k, v) in var.__dict__.items():                         newredkeystring = reducedkeystring + + "."                         dictOfOptVars, idlist = addOptVarToDict(v,                                                                 dictOfOptVars,                                                                 idlist,                                                                 newredkeystring)                  elif isinstance(var, OptVar):                     newreducedkeystring = reducedkeystring +                     dictOfOptVars[newreducedkeystring] = var              return dictOfOptVars, idlist          (dict_opt_vars, idlist) = addOptVarToDict(self, keystring="")         return dict_opt_vars    class C(OptVarContainer):     """     Specific implementation of class OptVarContainer     """     def __init__(self, name=""):         super(C, self).__init__(name=name,                 **{"my_c_a": {"c1": 1, "c2": 2},                    "my_c_b": {"c3": 3, "c4": 4}})   class B(OptVarContainer):     """     Specific implementation of class OptVarContainer     """     def __init__(self, name=""):         super(B, self).__init__(name=name, **{"b": {"1": 1, "2": 2}})         self.c_obj = C(name="cname")   class A(OptVarContainer):     """     Specific implementation of class OptVarContainer     """     def __init__(self, name=""):         super(A, self).__init__(name=name,                 **{"a1": {"1": 1, "2": 2},                    "a2": {"a": "a", "b": "b"}})         self.b_obj = B(name="bname")   def main():     # creating OptVarContainer with some nested OptVarContainers.     my_a_obj = A(name="aname")      # It is intended behaviour to access the OptVar objects via     # scoping within the class hierarchy.     print(my_a_obj.b_obj.b.parameters)     my_a_obj.b_obj.b.parameters["2"] = 3     print(my_a_obj.b_obj.b.parameters)     print(my_a_obj.b_obj.c_obj.my_c_a.parameters["c1"])     my_a_obj.b_obj.c_obj.my_c_a.parameters["c1"] = 6     print(my_a_obj.b_obj.c_obj.my_c_a.parameters)      # This construction is quite ugly:     # a) due to the dict: order is not fixed     # b) due to recursion (and maybe lexical sorting) it is not fast     # c) goal: hand over these optvars into some numerical optimization     # via a numpy array => should be fast     optvarsdict = my_a_obj.getAllOptVars()     print(optvarsdict)   if __name__ == "__main__":     main() 

The question is now: How to access the OptVar objects the best. I already thought about to use some kind of pool object and use some proxy within the class hierarchy to have a link to the pool. This pool should not be a singleton, since it should be possible to manage more than one pool at a time. Up to now the access to the OptVar variables within my own code is done via the getAllOptVars function. This is quite ugly and only considered temporary. Is there a better alternative to this function?

To summarize and clarify my goals:

  1. The class hierarchy is ok and reflects the model context of our problem
  2. The OptVars belong to each object in the hierarchy and should also stay there also due to model context
  3. The access and post processing of the OptVars (i.e. collecting them from the hierarchy and handing them over to an optimizer as a numpy array) is not considered to be optimal. There I need some suggestions on doing better (i.e. getting rid of isinstance and id queries).
  4. A nice to have would be: Decouple serialization of the OptVars and version management from the object hierarchy

I am aware that no unique solutions exist for this design problem, but I need further input on that.

The full context of this question is given here but after some discussions I separated the design part.