What do I do? how to cope with it?
worry about what's in front of you, do your best.
maybe taking a proactive step about layoffs will prevent your worry. hatch a scheme. make a move. secure your job.
Talk to a competent immigration attorney so you understand your options. The US offers a lot of visas.
A company circling the drain and going through rounds of layoffs will get to you eventually. If the company doesn't have huge problems that make you think it will lay everyone off and go out of business or get sold for IP, do what you can to keep the job. Make yourself indispensable. Do something no one else wants to do. I kept a job through three rounds of layoffs that took people senior to me by making myself the only person who understood the product database. Another guy at the same company knew the build process better than anyone else and survived as long as I did. We both had some time and runway to find other jobs instead biting our nails waiting for the surprise Friday afternoon meeting with HR.
I can't give specific advice, but you need to figure out how to keep your job, and that may mean stepping out of your comfort zone. One thing for sure: worrying and living in fear of something you may not have a lot of control over won't help, you need to take control of your life.
For example, you're probably not actually afraid of losing your job, but losing your paycheck. But you're not actually afraid of losing your paycheck, you're afraid of not paying your bills. But you're not actually afraid of not paying your bills, you're afraid of being evicted. But you're not actually afraid of being evicted, you're afraid of where you'll live afterwards. And then you realize you haven't actually thought about this situation, so it's just an abstract worry.
So your entire fear base is based on this abstract fear of "What will I do? I'll be screwed." If you dig into it more, you'll find concrete solutions. You might realize you have lots of savings so getting evicted due to not paying rent is really unlikely. And if you do get evicted, you can just go crash at a friend's place while you figure out your next steps. And worst case if no next steps happen, you can live with your parents. Etc etc.
I often find when doing this exercise is that what I'm actually afraid of is very unlikely to happen. It's the worst version of the worst scenario. And even if it does happen, it's actually not that bad and I can handle the situation just fine.
I've heard it estimated to me informally that the final cost for a company to sponsor a foreign citizen on a visa is around $5-10,000. That's a fair chunk of change, and some hassle in the meanwhile, but if you can get a good worker at a below market price many businesses would be willing to take the risk on hiring you. The risk of them losing you is also much smaller because of the visa situation, so don't think it's a hopeless sell by any means.
If it is at all possible, I would keep a minimum of $10,000 lying around in some easily-liquidatable form in case the oh shit moment finally drops. The reason you would want this is because you might have to break a rent contact, incurring a fine; move states; and start a new rent contract, all in very short order. That's a lot to have on your plate at once. You might have to buy a beater car if you don't have one already, etc. But you have the chance now to at least ensure you can survive if you end up in that situation. Never doubt the robustness and peace of mind a good solid chunk of savings can afford you.
If none of that pans out and you get ousted, you can at least pat yourself on the back and tell yourself you made the most logical moves afforded to you in the situation. With US techie experience you'll find it easier to break into other markets as well. I for example moved to Finland from the US a few years ago, almost right after graduating college, and the immigration policies here are miles easier to get through. The US is known worldwide for being a famously brutal market to work in, so that experience will travel well.
* money
* visa status
Money is probably a bit easier to deal with, so I'd focus on building your financial runway. Save whatever you can. Cut costs. I don't know your living situation at all, but think about big things (where you live, what you drive/how you commute) and little things (going out, subscriptions). Examine your expenses and come up with a barebones number. Is it $1000/month? $3,000? $6,000? I don't know, but you should figure that out. Then you can decide how many months or years of runway you'd need to feel comfortable, and aim to save that much.
Next, the visa issue. Others have suggested consulting an immigration lawyer. That makes a lot of sense to me. At the least, you'll know your situation more precisely (how many days after a layoff you'd have to find a job, what it would take to change your status, whether you can leave and work remotely, etc). Other options would be to start interviewing at companies who can provide you a visa, or making plans to return to your home country. Again, I don't know your situation, so can't make recommendations on which to choose.
Finally, I think it's important to acknowledge that you are probably valuable to your current employer. Why? Because you've survived 3 layoffs. So you are either a good employee, in a division that is doing relatively well, or both. If you want to stay at this company, I'd focus on that to help get you through the day.
I'm sorry you're in such a tough spot.
If your visa doesn't allow switching there are a few options:
1. H-1B at a research institution. These visas are available year round and don't have a cap. The pay will be bad, but it will let you stay in the US.
2. O-1 visa: this is harder, but not as hard as people think
3. Enroll for studies: If you have savings, you can switch to F-1, get a new degree that hopefully will enhance your earnings.
4. Look into immigration to Canada/UK/Germany which are trying to attract tech talent from the broken US immigration system.
If your fear blocks you from doing a good job the chance for you to get fired is higher.
The fear itself also blocks you from thinking which you need to do to take the necessary actions.
Accept first that this is 'just' how it is and yes it would be tremendously shitty and a lot of work if your worst case scenario happens BUT it would happen anyway.
So what to do?
1. Accept your situation. Talk to your partner you are not alone and together this problem already is smaller.
2. Start spending time on things which can help you: reduce house hold clutter, cleanup your CV, work well in your day job, rethink a nother country (Canada, Germany, etc)
Good luck!
Like others have suggested, if it's possible to switch jobs on your visa, start looking for something else. Even if you don't make the jump immediately, just going through the process of interviewing and seeing what other opportunities are available can greatly help with the stress/anxiety you're dealing with. You'll be reminded other options do exist.
"We have no power over external things, and the good that ought to be the object of our earnest pursuit, is to be found only within ourselves".
I've gone through two layoffs unscathed this year so far, both times I was more or less unconcerned with the outcome, because firstly I don't feel defined by my job, and secondly I'd kind of enjoy the challenge of getting something new. Granted having some savings does help, but focus on yourself, what you can do and you talents and you'll do alright
the fear really damages your mental health. The longer it goes on, it will drive you crazy and make you do inadvisable things and get paranoid.
My recommendation is make use of video therapists and career coaches to help you make better decisions.
If you talk to your peers, you are giving too much information to people around you. It’s a bad idea.
You can usually find virtual career coaches and therapists. Work through with them. It is a great idea to rely on outside help.
Your family : wife can’t help you. My experience is talking to my family and wife didn’t help. They just don’t understand.
A coach is actually incentivized to be objective and help you talk through problems and find solutions.
Keeping all this struggle in your head, you will make bad decisions and you are not objective. You are in an emotional space.
A coach can help provide a neutral 3rd party.
They can also help you brainstorm a practical strategy, how to talk and how to get to a better place and steps to take and accountability to have important conversations such as with your manager.
It costs money but the alternative is to go into a fear spiral and shut down and ruin your mental health.
It’s worth it.
I started talking to someone semi regularly and it is so incredibly useful to have someone confirming and validating your experience.
For example, I was in a toxic and disrespectful environment and by coach immediately called that out. No one around me or my boss would admit it was a bad environment.
The most dangerous thing you can do is sharing too much information with your peers or manager about your situation. I have learned not to ever talk to others around me about what I am going through.
They are your competition or looking for reasons to flag you.
Only a paid coach is going to be your friend. That’s how it is. We are in a dog eat dog environment. Any weakness signs are often a death sentence in such environments.
I also recommend improving nutrition. Eat a fruit : vegetable shake every morning to improve your health.
If you have a mineral or similar deficiency it can cause additional problems managing your emotions and with your self confidence.
There's no way I would risk my health again after what I went through from my first job; stomach ulcer is not a joke; I still suffer from it.
Weigh things what's best for you and move quickly before you regret it; it will be the best thing you will do to yourself!
The way I cope with this, is by making sure that my current contract does not define my future. I'm always interviewing and networking with new companies & clients (3-4x per month), and am working on my own startup, which after +1 year is slowly getting users. Perhaps there is no perfect advice here, but I cope by making sure that my job is as replaceable as me. I also have backup plans for if my visa doesn't work work out (spend some time in another country, where I already made plans to get around if my visa becomes a problem).