Software development around “SESSION_MANAGER”

The environment variable “SESSION_MANAGER” can contain a list of network identifiers.

  • Are any software libraries and higher level tools available which can make processing of the provided data a bit easier?
  • How should be determined which programs offer connection possibilities there?

It may be me, but I do not understand very much of your question.

I looks to me like you want to program something, but this is in Network/Internet and not in Development > Programming/Scripting.

You talk about the contentrs of an environment variable, but do not even take the trouble to show it. In my system, with my session:

henk@boven:~> echo $SESSION_MANAGER
local/boven:@/tmp/.ICE-unix/2067,unix/boven:/tmp/.ICE-unix/2067
henk@boven:~>

I may be completely wrong, but by showing it and then telling what you want to do with it and why and what it has to do with networking and where you got stuck, it may be possible that others may be able to help you further.

Are you aware about the data structures that can be stored within “SESSION_MANAGER” according to the published documentation?

local/boven:@/tmp/.ICE-unix/2067,unix/boven:/tmp/.ICE-unix/2067

I may be completely wrong, but by showing it and then telling what you want to do with it

I would like to determine occasionally which programs offer connection possibilities for inter-process communication here.

and why and what it has to do with networking

The X software is using it, isn’t it?

and where you got stuck, …

I would like to check the session-awareness for various software tools further.
Which special properties should also be stored so that usage of such tools will become more convenient and safe?

First,
I know very little about SESSION_MANAGER.
The little I know is due to my very infrequent encountering it during logged in sessions.
Based on my exposure to application code particularly relating to various web protocols, I’ve generally thought of network session management to be managed by something else, but that’s only a feeling.

If you do a general Google search,
My “feeling” seems to be more or less confirmed because the hits I get don’t seem to mention anything different. The only network related hits I get relate to remote sessions using SSH or VNC.
Other hits also point out that SESSION_MANAGER is one of the few standard internal BASH variables, so SESSION_MANAGER may not be relevant using other script environments.
http://unix.stackexchange.com/questions/72131/detecting-x-session-in-a-bash-script-bashrc-etc
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_02.html

So,
Even after your general description of your objectives, your path forward is fuzzy to me.
If you’re looking for detecting the existence of other apps for IPC, I haven’t seen SESSION_MANAGER used before. more commonly either the app is tested by name or its PiD if that is constant or set consistently.
If you’re testing for a running X session, my first link above discusses that briefly.
If you’re testing for a network session, as I described AFAIK unless it’s a remote logged in session I don’t think that SESSION_MANAGER is the way to do it.

In general,
Nowadays the world is such that very few things are truly original so if you can describe your code objectives sufficiently (not specifying a particular method of course which is a common pitfall), you should be able to find a code example someone else has already written.

Lastly, for a pure coding question like this, I’d recommend you post in the “Programming and Scripting” forum instead of this Applications forum which is mostly about finished apps.
https://forums.opensuse.org/forumdisplay.php/678-Programming-Scripting

IMO and with some speculation,
TSU

How do you think about to extend the knowledge for the practical usage of this environment variable a bit more?

…, I’ve generally thought of network session management to be managed by something else, …

Can this interface belong to a general functionality?

If you’re looking for detecting the existence of other apps for IPC,

Would you like to check which programs are using the provided data for inter-process communication in useful ways?

I haven’t seen SESSION_MANAGER used before.

I find such a feedback strange. :\ - I guess that this variable is also used in your software environments to some degree already.

Lastly, for a pure coding question like this, …

Thanks for your suggestion. - But this issue is not only relevant for programming. I became also more interested in corresponding software evolution for better and safer system administration.

Under which circumstances would you care more if an application does not store all relevant software properties so that an interrupted work flow could not be restored later because of this limitation?

I don’t know if the many types of sessions are managed in the SESSION_MANAGER variable, and generally my approach isn’t to fight for what might make personal sense but to try to inspect and observe, plus use any available documentation to work with “what is.” In other words, IMO a practical approach will serve better than any pre-conceived personal opinion unless there is some particularly strong reason to question current conventional practice.

That is the underlying approach to my suggestion that you look for existing code examples, if you’re on the right track then you’ll likely find that others have tried to solve possibly even successfully what you are trying to achieve. But, if you find nothing then that is probably a sign you are on the wrong track. If for some reason you really do believe that you are trying to solve a problem never before conceived by anyone before you, then yes… It’ll be a lot of work but this is generally a very rare scenario. You <really> have to ask yourself if no one ever, in the history of what can be Googled today has ever tried to do what you’re attempting?

As I described… I <have> seen scenarios where if I understand what you are trying to do, others have successfully written their apps in a different way and did not use SESSION_MANAGER.

TSU

Regarding more specifically the link you provided for XSMP

AFAIK that is a very specific type of session management, and unless I overlooked it, $SESSION_MANAGER is not the primary place to store XSMP variables but can be used as a fallback, so may not be reliable but is there to use.

Skimming the documentation,
I don’t know how useful it might be without a fairly substantial amount of work.
Seems to me that it’s a possible IPC method, but while you can query and return info, there is no guarantee that whatever you’re querying for exists… If you’re querying for anything other than X sessions, you just won’t likely find that “other thing” generating the data you need and also in your proposed Use case inserting that data into SESSION_MANAGER.

So,
IMO you’re probably safest to just use XSMP exactly for what it describes it should be used for, and not try to extend use to something else.

TSU

I would appreciate if more applications will become session-aware.

:\ How would you check if a specific software implementation is incomplete according to the published process communication protocols?

The IPC method I’m most familiar with is using UNIX sockets, you’ll get some good hits if you Google

inter-process communication sockets

You can test availability and connectivity to apps by using UNIX sockets for “very” internal machine communications, Named Pipes for a way which I consider “semi-internal/external” communications, and network sockets for external communications (even on the same machine). Some real world examples of apps talking to apps… Named Pipes is sometimes used to define a website to database connection, and network sockets is synonymous for using IP addressing type network connections like connecting to a database server configured to listen on localhost.

You’ll need to ask yourself why sessions are so important to you. I don’t know that is any real concern with today’s OS because of their ability to multi-task… so it’s not like there might be some kind of availability issue so that sessions might be blocking.

IMO,
TSU

  • How do you think about to check which programs will be connected by this data exchange interface in a concrete system configuration?
  • Would you like to determine the corresponding executable files by any lookup tool occasionally?

You’ll need to ask yourself why sessions are so important to you.

  • I find it nice when my computer work environment is automatically restored on demand after a work flow is occasionally interrupted.
  • Would any more users share their experiences around this functionality?

Which impressions do you get from application information like the following?

I don’t know that is any real concern with today’s OS because of their ability to multi-task…

I wonder on how such an aspect should matter for this issue.

so it’s not like there might be some kind of availability issue so that sessions might be blocking.

I am not concerned about a blocking behaviour here.

Maybe I was not clear about your asking yourself the reason for checking for session status.
The way computing works is not generally based on sessions but on processes and threads.
And, based on the above execution plans are automatically and manually configured to perform as optimally as possible.
Although there is some similarity between sessions and execution plans, they’re not really about the same things.

You may also be mistaken that if an executable is invoked, then that executable is “busy” and unavailable for other use.
That’s not true, at least in systemd. If an additional instance of an executable is needed (eg another bash console), then another child process is spawned identical to the original for that new use. Again, no blocking.

As for objects like sockets, they’re available on a limited basis, but this has more to do with system optimization allocating sufficient resources and reading usage data for that particular object, not something only secondarily relevant like session data.

If you are not concerned about blocking, then for what reason do you think that session status and data is important?
Session data might be relevant in some scenarios, but you need to determine if any of those scenarios are relevant to what you are trying to do.

TSU

Under which circumstances do you treat them in a way that a combination of programs belong to a work session?

And, based on the above execution plans are automatically and manually configured to perform as optimally as possible.

:\ Can it be that you have got anything different in mind than how I am trying to clarify software difficulties and challenges around session management?

If you are not concerned about blocking, then for what reason do you think that session status and data is important?

I would like to store snapshots of program combinations so that session variants can be compared and tested further.

Session data might be relevant in some scenarios, but you need to determine if any of those scenarios are relevant to what you are trying to do.

Session-unaware applications disturb my work flow.

I think you may have an incorrect idea about what happens in a computing machine… or, at least different than what I believe.

Ordinarily, competing applications running in a busy machine are like a chaotic mob… Some can shout louder, they’re all elbowing each other wanting time and attention. There is no management, and everything gets as much done as possible according to some very loose rules set by the processor hardware and OS.

So, there isn’t really the kind of orderly “session management” you seem to be seeking.
And, even if there were the link I provided you states that the $SESSION_MANAGEMENT variable isn’t even the primary way to store that kind of information so can’t be considered authoritative.

But, some have noticed in the past that this chaotic environment isn’t always efficient or optimal and doesn’t do anything to prevent “bad behavior” so then managed application environments were created… The primary examples today are the JRE (Java) and CLR (Mono and dotNET) environments. So, in each of these two as examples, you <will> find that objects like sessions and resource utilization is carefully registered, monitored and various housekeeping like garbage collection is implemented instead of requiring the app developer to write those features into the app.

HTH and IMO,
TSU

I get the impression that you are thinking in software directions which do not really fit to the initial discussion topic. :?

… that the $SESSION_MANAGEMENT variable …

Would you like to check the desired consequences from the usage of the environment variable “SESSION_MANAGER” once more?

… so can’t be considered authoritative.

  • Should the “X Session Management Protocol” belong to one of the well respected software development standards since decades?
  • How do you think about further possibilities around D-Bus communication interfaces?

Just saying you have to understand the environment you’re working in,
I can’t argue for something that isn’t available or should be just because someone wants it so…

And D-bus is just another means for apps to communicate with each other…

TSU

X standard protocols are available since decades. How do you think about to make any more programs session-aware in this sense?

And D-bus is just another means for apps to communicate with each other…

Will this programming interface influence the ways in which work sessions will be managed better?

Recommend you do some research on your own questions.

As I described, others before you recognized a lack of management and have built frameworks to address perceived shortcomings. Even systemd largely is an effort addressing some of those issues.

Computing evolves at a pace affected by a number of parameters.
If you feel you’ve identified something worth addressing, then find like-minded people and go ahead and do something about it.

TSU

How are the chances to find “like-minded people” by discussing topics in this forum?

You’ll just have to reach out as many ways as you can.
These Forums are typically seen only by openSUSE people but your interest isn’t openSUSE-specific.

So, for instance…
Create a website which states your mission. Github is one way to create a free website, and by so doing your content will also be searchable by everyone who uses Github.
Usual modern online media like Facebook, Twitter, etc.

Promote your idea everywhere you can.
If people respond, they might ask questions, they might join you(or not) but it’ll test your understanding and the worth of your ideas.
Bottom line is, the more ways you reach out and talk to more people, the more you’ll learn, too.

But, be prepared to show people an understanding of what you are promoting… Which means you should do as much research on your own first. That’s the great thing about the Internet today… You don’t necessarily have to crack open a real book or take courses but you better have the equivalence of information and understanding.

Good Luck,
TSU